Skip to contentSkip to conversation

prctl: add flags to enable KSM at the process level

PATCH New Stefan Roesch 1 participant 1 message Feb 27, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 prctl: add flags to enable KSM at the process level

This adds two new flags to the prctl documentation: PR_SET_MEMORY_MERGE and PR_GET_MEMORY_MERGE. The flags allow to enable KSM (kernel samepage merging) at the process level and query is state.

The "mm: process/cgroup ksm support" patch series has been posted to the mm mailing list and it enables this feature.

---
 man2/prctl.2 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
man2/prctl.2 +20 -0
index 2212331af0e4..d10334484bf7 100644
@@ -591,6 +591,26 @@ the current per-process machine check kill policy.
 All unused
 .BR prctl ()
 arguments must be zero.
+.\" prctl PR_SET_MEMORY_MERGE
+.TP
+.BR PR_SET_MEMORY_MERGE " (since Linux 6.4)"
+Enable the KSM (kernel samepage merging) feature for this process. If
+.I arg2
+is nonzero, KSM gets enabled for this process. Child processes will inherit the
+setting.
+.IP
+The calling process must have the
+.B CAP_SYS_RESOURCE
+capability.
+.\" prctl PR_GET_MEMORY_MERGE
+.TP
+.BR PR_GET_MEMORY_MERGE " (since Linux 6.4)"
+Return (as the function result) if KSM (kernel samepage merging) has been
+enabled for this process. All unused prctl() arguments must be NULL.
+.IP
+The calling process must have the
+.B CAP_SYS_RESOURCE
+capability.
 .\" prctl PR_SET_MM
 .TP
 .BR PR_SET_MM " (since Linux 3.3)"

base-commit: 53a7e5dfc3554a2e8dbdfdc4504e99652e1d6382

Signature · 1 line
2.30.2