]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: add support for disabling THPs (#39085)
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Jan 2026 16:36:20 +0000 (01:36 +0900)
committerGitHub <noreply@github.com>
Tue, 6 Jan 2026 16:36:20 +0000 (01:36 +0900)
commit0ab02b67d4c3d3a6b26ae55872bf745391e80ff8
treec9e41e554148ab6ebc724830a69ddffd5fbcb95c
parentfcc6b299210585f2ed3cfa4e4cdc01a0195d3fc3
parent4d16530b83ce9921904d560675a9571fc351fe96
core: add support for disabling THPs (#39085)

Transparent Hugepages (THP) is a Linux kernel feature that manages
memory using larger pages (2MB on x86, compared to the default 4KB). The
main goal is to improve memory management efficiency and system
performance, especially for memory-intensive applications. However, it
can cause drawbacks in some scenarios, such as memory regression and
latency spikes. THP policy is governed for the entire system via
/sys/kernel/mm/transparent_hugepage/enabled.
However, it can be overridden for individual workloads via prctl(2) call.
MemoryTHP= is used to disable THPs at exec-invoke to stop providing THPs
for workloads where the drawbacks outweigh the advantages. When set to
"disable", MemoryTHP= disables THPs completely for the process,
irrespective of global THP controls.

[1] https://man7.org/linux/man-pages/man2/PR_SET_THP_DISABLE.2const.html
[2] https://man7.org/linux/man-pages/man2/madvise.2.html
[3] https://github.com/torvalds/linux/commit/9dc21bbd62edeae6f63e6f25e1edb7167452457b