Debian 10: How to disable transparent hugepages

“Transparent Hugepages” is a Linux kernel feature intended to improve performance by making more efficient use of your processor’s memory-mapping hardware. It is enabled (“enabled=always”) by default in most Linux distributions.

Transparent Hugepages gives some applications a small performance improvement (~ 10% at best, 0-3% more typically), but can cause significant performance problems, or even apparent memory leaks at worst.

How to disable it?

Edit the file /etc/default/grub and modify this row :


and add the parameter transparent_hugepage=never:


After modifying the file, you will need to load the new grub configurations to the kernels installed on the system by running the following command:


Once the command has been executed, you will need to restart the server and check if the change has been made.

[email protected]:~# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

The parameter must be set to [never]

[email protected]:~# cat /proc/meminfo 
MemTotal:        4017664 kB
MemFree:         2734024 kB
MemAvailable:    3560848 kB
Buffers:            2128 kB
Cached:           855052 kB
SwapCached:            0 kB
Active:           557660 kB
Inactive:         521148 kB
Active(anon):     189272 kB
Inactive(anon):    40432 kB
Active(file):     368388 kB
Inactive(file):   480716 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       1003516 kB
SwapFree:        1003516 kB
Dirty:                32 kB
Writeback:             0 kB
AnonPages:        221628 kB
Mapped:           149984 kB
Shmem:             41292 kB
Slab:              89528 kB
SReclaimable:      36700 kB
SUnreclaim:        52828 kB
KernelStack:        7088 kB
PageTables:         4192 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     3012348 kB
Committed_AS:    2186128 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:            47104 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      116544 kB
DirectMap2M:     3028992 kB
DirectMap1G:     3145728 kB

You can see the Value AnonHugePages is set at 0 kB.

Enjoy 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *