Skip to contentSkip to conversation

man2/set_mempolicy.2: Add mode flag MPOL_F_NUMA_BALANCING

PATCH In review Huang Ying 2 participants 3 messages Mar 1, 2021 – Mar 10, 2021 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 1/1 man2/set_mempolicy.2: Add mode flag MPOL_F_NUMA_BALANCING

In Linux kernel 5.12, a new mode flag MPOL_F_NUMA_BALANCING is added to set_mempolicy() to optimize the page placement among the NUMA nodes with the NUMA balancing mechanism even if the memory of the applications are bound with MPOL_BIND. This patch update the man page for the new mode flag.

Related kernel commits:
bda420b985054a3badafef23807c4b4fa38a3dff

Cc "Alejandro Colomar" <[email protected]>
Cc "Michael Kerrisk" <[email protected]>
---
 man2/set_mempolicy.2 | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)
man2/set_mempolicy.2 +28 -6
index 6e695fb13..cd543667f 100644
@@ -98,6 +98,28 @@ The supported
 .I "mode flags"
 are:
 .TP
+.BR MPOL_F_NUMA_BALANCING " (since Linux 5.12)"
+When
+.I mode
+is
+.BR MPOL_BIND ,
+enable the kernel NUMA balancing for the task if it is supported by
+the kernel.
+If the flag isn't supported by the kernel, or is used with
+.I mode
+other than
+.BR MPOL_BIND ,
+\-1 is returned and
+.I errno
+is set to
+.BR EINVAL .
+.TP
+.BR MPOL_F_RELATIVE_NODES " (since Linux 2.6.26)"
+A nonempty
+.I nodemask
+specifies node IDs that are relative to the set of
+node IDs allowed by the process's current cpuset.
+.TP
 .BR MPOL_F_STATIC_NODES " (since Linux 2.6.26)"
 A nonempty
 .I nodemask
@@ -107,12 +129,6 @@ Linux will not remap the
 when the process moves to a different cpuset context,
 nor when the set of nodes allowed by the process's
 current cpuset context changes.
-.TP
-.BR MPOL_F_RELATIVE_NODES " (since Linux 2.6.26)"
-A nonempty
-.I nodemask
-specifies node IDs that are relative to the set of
-node IDs allowed by the process's current cpuset.
 .PP
 .I nodemask
 points to a bit mask of node IDs that contains up to
@@ -293,6 +309,12 @@ argument specified both
 .B MPOL_F_STATIC_NODES
 and
 .BR MPOL_F_RELATIVE_NODES .
+Or, the
+.B MPOL_F_NUMA_BALANCING
+isn't supported by the kernel, or is used with
+.I mode
+other than
+.BR MPOL_BIND .
 .TP
 .B ENOMEM
 Insufficient kernel memory was available.
Signature · 1 line
2.30.1
#1 lore raw
Quoted 8 lines · Huang Ying

In Linux kernel 5.12, a new mode flag MPOL_F_NUMA_BALANCING is added to set_mempolicy() to optimize the page placement among the NUMA nodes with the NUMA balancing mechanism even if the memory of the applications are bound with MPOL_BIND. This patch update the man page for the new mode flag.

Related kernel commits:
bda420b985054a3badafef23807c4b4fa38a3dff

Hi, Colomar,

Do you have time to take a look at this patch? It has been reviewed in the following thread,

https://lore.kernel.org/lkml/[email protected]/

Now the corresponding kernel change has been merged by upstream kernel. Do you have further comments?

Best Regards,
Huang, Ying

Quoted 66 lines
Cc "Alejandro Colomar" <[email protected]>
Cc "Michael Kerrisk" <[email protected]>
---
 man2/set_mempolicy.2 | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)
man2/set_mempolicy.2 +28 -6
index 6e695fb13..cd543667f 100644
@@ -98,6 +98,28 @@ The supported
 .I "mode flags"
 are:
 .TP
+.BR MPOL_F_NUMA_BALANCING " (since Linux 5.12)"
+When
+.I mode
+is
+.BR MPOL_BIND ,
+enable the kernel NUMA balancing for the task if it is supported by
+the kernel.
+If the flag isn't supported by the kernel, or is used with
+.I mode
+other than
+.BR MPOL_BIND ,
+\-1 is returned and
+.I errno
+is set to
+.BR EINVAL .
+.TP
+.BR MPOL_F_RELATIVE_NODES " (since Linux 2.6.26)"
+A nonempty
+.I nodemask
+specifies node IDs that are relative to the set of
+node IDs allowed by the process's current cpuset.
+.TP
 .BR MPOL_F_STATIC_NODES " (since Linux 2.6.26)"
 A nonempty
 .I nodemask
@@ -107,12 +129,6 @@ Linux will not remap the
 when the process moves to a different cpuset context,
 nor when the set of nodes allowed by the process's
 current cpuset context changes.
-.TP
-.BR MPOL_F_RELATIVE_NODES " (since Linux 2.6.26)"
-A nonempty
-.I nodemask
-specifies node IDs that are relative to the set of
-node IDs allowed by the process's current cpuset.
 .PP
 .I nodemask
 points to a bit mask of node IDs that contains up to
@@ -293,6 +309,12 @@ argument specified both
 .B MPOL_F_STATIC_NODES
 and
 .BR MPOL_F_RELATIVE_NODES .
+Or, the
+.B MPOL_F_NUMA_BALANCING
+isn't supported by the kernel, or is used with
+.I mode
+other than
+.BR MPOL_BIND .
 .TP
 .B ENOMEM
 Insufficient kernel memory was available.
#2 lore raw
In reply to Huang Ying

Hi Huang Ying,

Quoted 6 lines · Huang Ying

In Linux kernel 5.12, a new mode flag MPOL_F_NUMA_BALANCING is added to set_mempolicy() to optimize the page placement among the NUMA nodes with the NUMA balancing mechanism even if the memory of the applications are bound with MPOL_BIND. This patch update the man page for the new mode flag.

Quoted 6 lines

Related kernel commits:
bda420b985054a3badafef23807c4b4fa38a3dff

Cc "Alejandro Colomar" <[email protected]>
Cc "Michael Kerrisk" <[email protected]>

Sorry for the delay. Patch applied.

Thanks!

Alex

Quoted 64 lines
---
  man2/set_mempolicy.2 | 34 ++++++++++++++++++++++++++++------
  1 file changed, 28 insertions(+), 6 deletions(-)
man2/set_mempolicy.2 +28 -6
index 6e695fb13..cd543667f 100644
@@ -98,6 +98,28 @@ The supported
  .I "mode flags"
  are:
  .TP
+.BR MPOL_F_NUMA_BALANCING " (since Linux 5.12)"
+When
+.I mode
+is
+.BR MPOL_BIND ,
+enable the kernel NUMA balancing for the task if it is supported by
+the kernel.
+If the flag isn't supported by the kernel, or is used with
+.I mode
+other than
+.BR MPOL_BIND ,
+\-1 is returned and
+.I errno
+is set to
+.BR EINVAL .
+.TP
+.BR MPOL_F_RELATIVE_NODES " (since Linux 2.6.26)"
+A nonempty
+.I nodemask
+specifies node IDs that are relative to the set of
+node IDs allowed by the process's current cpuset.
+.TP
  .BR MPOL_F_STATIC_NODES " (since Linux 2.6.26)"
  A nonempty
  .I nodemask
@@ -107,12 +129,6 @@ Linux will not remap the
  when the process moves to a different cpuset context,
  nor when the set of nodes allowed by the process's
  current cpuset context changes.
-.TP
-.BR MPOL_F_RELATIVE_NODES " (since Linux 2.6.26)"
-A nonempty
-.I nodemask
-specifies node IDs that are relative to the set of
-node IDs allowed by the process's current cpuset.
  .PP
  .I nodemask
  points to a bit mask of node IDs that contains up to
@@ -293,6 +309,12 @@ argument specified both
  .B MPOL_F_STATIC_NODES
  and
  .BR MPOL_F_RELATIVE_NODES .
+Or, the
+.B MPOL_F_NUMA_BALANCING
+isn't supported by the kernel, or is used with
+.I mode
+other than
+.BR MPOL_BIND .
  .TP
  .B ENOMEM
  Insufficient kernel memory was available.
Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/