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.
This commit is contained in:
+4
-2
@@ -1117,7 +1117,8 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
"%sProtectHostname: %s%s%s\n"
|
||||
"%sProtectProc: %s\n"
|
||||
"%sProcSubset: %s\n"
|
||||
"%sPrivateBPF: %s\n",
|
||||
"%sPrivateBPF: %s\n"
|
||||
"%sMemoryTHP: %s\n",
|
||||
prefix, c->umask,
|
||||
prefix, empty_to_root(c->working_directory),
|
||||
prefix, empty_to_root(c->root_directory),
|
||||
@@ -1145,7 +1146,8 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
prefix, protect_hostname_to_string(c->protect_hostname), c->private_hostname ? ":" : "", strempty(c->private_hostname),
|
||||
prefix, protect_proc_to_string(c->protect_proc),
|
||||
prefix, proc_subset_to_string(c->proc_subset),
|
||||
prefix, private_bpf_to_string(c->private_bpf));
|
||||
prefix, private_bpf_to_string(c->private_bpf),
|
||||
prefix, memory_thp_to_string(c->memory_thp));
|
||||
|
||||
if (c->private_bpf == PRIVATE_BPF_YES) {
|
||||
_cleanup_free_ char
|
||||
|
||||
Reference in New Issue
Block a user