]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: introduce MemoryTHP= unit file setting
authorUsama Arif <usamaarif642@gmail.com>
Mon, 15 Sep 2025 12:33:28 +0000 (13:33 +0100)
committerUsama Arif <usamaarif642@gmail.com>
Tue, 6 Jan 2026 11:26:14 +0000 (03:26 -0800)
commit32614b9aab5a5c9b5be22b635fefdbccef90adc3
tree30a9cd6a97742d399b4af90fe6d17422a74f618d
parent9573ad4e76d28b459123cfb4b5cffab474738ab3
core: introduce MemoryTHP= unit file setting

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, irrespecitive of global THP controls.
When set to "madvise", MemoryTHP= disables THPs for the process except
when specifically madvised by the process with MADV_HUGEPAGE or MADV_COLLAPSE.
18 files changed:
man/org.freedesktop.systemd1.xml
man/systemd.exec.xml
src/core/dbus-execute.c
src/core/exec-invoke.c
src/core/execute-serialize.c
src/core/execute.c
src/core/execute.h
src/core/load-fragment-gperf.gperf.in
src/core/load-fragment.c
src/core/load-fragment.h
src/core/namespace.c
src/core/namespace.h
src/core/varlink-execute.c
src/include/musl/sys/prctl.h
src/shared/bus-unit-util.c
src/shared/exit-status.c
src/shared/exit-status.h
src/shared/varlink-io.systemd.Unit.c