--- Adding documentation for the new MPOL_WEIGHTED_INTERLEAVE mode in the same manpages that mention MPOL_INTERLEAVE; namely, mbind(2), set_mempolicy(2), and get_mempolicy(2). Descriptions were based on the changes introduced in this patch: https://lore.kernel.org/all/20240202170238.90004-4-gregory.price@xxxxxxxxxxxx/ Which was upstreamed to 6.9 here: https://lore.kernel.org/linux-mm/20240313200532.34e4cff216acd3db8def4637@xxxxxxxxxxxxxxxxxxxx/ Signed-off-by: Svetly Todorov <svetly.todorov@xxxxxxxxxxxx> --- man2/get_mempolicy.2 | 8 ++++++-- man2/mbind.2 | 13 +++++++++++++ man2/set_mempolicy.2 | 13 +++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/man2/get_mempolicy.2 b/man2/get_mempolicy.2 index 5248f04ba..03550331d 100644 --- a/man2/get_mempolicy.2 +++ b/man2/get_mempolicy.2 @@ -137,7 +137,9 @@ specifies but not .BR MPOL_F_ADDR , and the thread's current policy is -.BR MPOL_INTERLEAVE , +.BR MPOL_INTERLEAVE +or +.BR MPOL_WEIGHTED_INTERLEAVE , then .BR get_mempolicy () will return in the location pointed to by a non-NULL @@ -206,7 +208,9 @@ specified but not .B MPOL_F_ADDR and the current thread policy is not -.BR MPOL_INTERLEAVE . +.BR MPOL_INTERLEAVE +or +.BR MPOL_WEIGHTED_INTERLEAVE . Or, .I flags specified diff --git a/man2/mbind.2 b/man2/mbind.2 index b0e961f9c..cc994a01e 100644 --- a/man2/mbind.2 +++ b/man2/mbind.2 @@ -105,6 +105,7 @@ argument must specify one of .BR MPOL_DEFAULT , .BR MPOL_BIND , .BR MPOL_INTERLEAVE , +.BR MPOL_WEIGHTED_INTERLEAVE , .BR MPOL_PREFERRED , or .B MPOL_LOCAL @@ -243,6 +244,18 @@ at least 1\ MB or bigger with a fairly uniform access pattern. Accesses to a single page of the area will still be limited to the memory bandwidth of a single node. .TP +.B MPOL_WEIGHTED_INTERLEAVE +This mode interleaves page allocations across the nodes specified in +.I nodemask +according to the weights in /sys/kernel/mm/mempolicy/weighted_interleave. +That is, if bits 0, 2, and 5 are raised in +.IR nodemask , +and the contents of /sys/kernel/mm/mempolicy/weighted_interleave/node0, +/sys/.../node2, and /sys/.../node5 are 4, 7, and 9, respectively, then +the first 4 pages in this region will be allocated on node 0; +the next 7 will be on node 2; and the next 9 on node 5. +Subsequent allocations will continue in this pattern. +.TP .B MPOL_PREFERRED This mode sets the preferred node for allocation. The kernel will try to allocate pages from this diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 index fc3ad9df8..a1b11b307 100644 --- a/man2/set_mempolicy.2 +++ b/man2/set_mempolicy.2 @@ -63,6 +63,7 @@ argument must specify one of .BR MPOL_DEFAULT , .BR MPOL_BIND , .BR MPOL_INTERLEAVE , +.BR MPOL_WEIGHTED_INTERLEAVE , .BR MPOL_PREFERRED , or .B MPOL_LOCAL @@ -199,6 +200,18 @@ the memory bandwidth of a single node. .\" To be effective the memory area should be fairly large, .\" at least 1 MB or bigger. .TP +.B MPOL_WEIGHTED_INTERLEAVE +This mode interleaves page allocations across the nodes specified in +.I nodemask +according to the weights in /sys/kernel/mm/mempolicy/weighted_interleave. +That is, if bits 0, 2, and 5 are raised in +.IR nodemask , +and the contents of /sys/kernel/mm/mempolicy/weighted_interleave/node0, +/sys/.../node2, and /sys/.../node5 are 4, 7, and 9, respectively, then +the first 4 pages in this region will be allocated on node 0; +the next 7 will be on node 2; and the next 9 on node 5. +Subsequent allocations will continue in this pattern. +.TP .B MPOL_PREFERRED This mode sets the preferred node for allocation. The kernel will try to allocate pages from this node first --- base-commit: a4ea5f76215dcf1d8d017eb65ab12919ccf09f3f change-id: 20240313-weighted_interleave-e8141ed754f9 Best regards, -- Svetly Todorov <svetly.todorov@xxxxxxxxxxxx>