Skip to content

Commit

Permalink
MDEV-33279 Disable transparent huge pages after page buffers has been…
Browse files Browse the repository at this point in the history
… allocatedDisable transparent huge pages (THP)

The reason for disabling transparent huge pages (THP) is that they
do not work well with MariaDB (or other databases, see links in
MDEV-33279). The effect of using THP are that MariaDB will use much more
(10x) more memory and will no be able to release memory back to the system.

Disabling THP is done after all storage engines are started, to allow
buffer pools and keybuffers (big allocations) to be allocated as huge
pages.
  • Loading branch information
montywi committed Jan 23, 2024
1 parent 740d3e7 commit c777429
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5451,6 +5451,15 @@ static int init_server_components()
#else
locked_in_memory= 0;
#endif
#ifdef PR_SET_THP_DISABLE
/*
Engine page buffers are now allocated.
Disable transparent huge pages for all
future allocations as these causes memory
leaks.
*/
prctl(PR_SET_THP_DISABLE, 1, 0, 0, 0);
#endif

ft_init_stopwords();

Expand Down

0 comments on commit c777429

Please sign in to comment.