Skip to contentSkip to conversation

mm/mempolicy.c: forbid static or relative flags for local NUMA mode

PATCH Superseded Piotr Kwapulinski 6 participants 24 messages Sep 18, 2016 – Nov 1, 2016

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

PATCH 1/1 mm/mempolicy.c: forbid static or relative flags for local NUMA mode

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy. Return the "invalid argument" from set_mempolicy whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It also slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).
Isolated tests done.

---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mempolicy.c +3 -1
index 2da72a5..27b07d1 100644
@@ -276,7 +276,9 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
 				return ERR_PTR(-EINVAL);
 		}
 	} else if (mode == MPOL_LOCAL) {
-		if (!nodes_empty(*nodes))
+		if (!nodes_empty(*nodes) ||
+		    (flags & MPOL_F_STATIC_NODES) ||
+		    (flags & MPOL_F_RELATIVE_NODES))
 			return ERR_PTR(-EINVAL);
 		mode = MPOL_PREFERRED;
 	} else if (nodes_empty(*nodes))
Signature · 7 lines
2.9.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 4 lines · Piotr Kwapulinski

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy. Return the "invalid argument" from set_mempolicy whenever any of these flags is passed along with MPOL_LOCAL.

man 2 set_mempolicy doesn't list this as invalid option. Maybe this is a documentation bug but is it possible that somebody will see this as an unexpected error?

Quoted 5 lines

It is consistent with MPOL_PREFERRED passed with empty nodemask. It also slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).

I am not sure I understand this argument. What does this patch actually fix? If this is about the execution time then why not just bail out early when MPOL_LOCAL && (MPOL_F_STATIC_NODES || MPOL_F_RELATIVE_NODES)

Quoted 24 lines

Isolated tests done.

---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mempolicy.c +3 -1
index 2da72a5..27b07d1 100644
@@ -276,7 +276,9 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
 				return ERR_PTR(-EINVAL);
 		}
 	} else if (mode == MPOL_LOCAL) {
-		if (!nodes_empty(*nodes))
+		if (!nodes_empty(*nodes) ||
+		    (flags & MPOL_F_STATIC_NODES) ||
+		    (flags & MPOL_F_RELATIVE_NODES))
 			return ERR_PTR(-EINVAL);
 		mode = MPOL_PREFERRED;
 	} else if (nodes_empty(*nodes))
Signature · 1 line
2.9.2
Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw
Quoted 10 lines · Michal Hocko
Quoted 4 lines · Piotr Kwapulinski

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy. Return the "invalid argument" from set_mempolicy whenever any of these flags is passed along with MPOL_LOCAL.

man 2 set_mempolicy doesn't list this as invalid option. Maybe this is a documentation bug but is it possible that somebody will see this as an unexpected error?

The MPOL_LOCAL is currently not documented in "man set_mempolicy(2)". In case the nodemask is empty for MPOL_LOCAL it is transformed into MPOL_PREFERRED. The motivation for disabling MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags for MPOL_PREFERRED with empty nodemask is described at this commit 3e1f064562fcff7. Currently I call set_mempolicy(MPOL_LOCAL, ...) via the syscall() but despite of that it is inconsistent with MPOL_PREFERRED.

Quoted 10 lines
Quoted 5 lines

It is consistent with MPOL_PREFERRED passed with empty nodemask. It also slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).

I am not sure I understand this argument. What does this patch actually fix? If this is about the execution time then why not just bail out early when MPOL_LOCAL && (MPOL_F_STATIC_NODES || MPOL_F_RELATIVE_NODES)

The mpol_new() performs additional checks on nodemask.

Quoted 16 lines
Quoted 16 lines

Isolated tests done.

---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mempolicy.c +0 -1
index 2da72a5..27b07d1 100644
@@ -276,7 +276,9 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
 				return ERR_PTR(-EINVAL);
 		}
 	} else if (mode == MPOL_LOCAL) {
-		if (!nodes_empty(*nodes))
Quoted 12 lines
Quoted 8 lines
mm/mempolicy.c +3 -0
+		if (!nodes_empty(*nodes) ||
+		    (flags & MPOL_F_STATIC_NODES) ||
+		    (flags & MPOL_F_RELATIVE_NODES))
 			return ERR_PTR(-EINVAL);
 		mode = MPOL_PREFERRED;
 	} else if (nodes_empty(*nodes))
Signature · 1 line
2.9.2
Signature · 2 lines
Michal Hocko
SUSE Labs

--
Piotr Kwapulinski

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#3 lore raw
In reply to Piotr Kwapulinski
Quoted 11 lines · Piotr Kwapulinski

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy. Return the "invalid argument" from set_mempolicy whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It also slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).
Isolated tests done.

Quoted 1 line

There wasn't an MPOL_LOCAL when I introduced either of these flags, it's an oversight to allow them to be passed.

Want to try to update set_mempolicy(2) with the procedure outlined in
https://www.kernel.org/doc/man-pages/patches.html as well?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
Quoted 15 lines · David Rientjes
Quoted 11 lines · Piotr Kwapulinski

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy. Return the "invalid argument" from set_mempolicy whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It also slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).
Isolated tests done.

Quoted 1 line
Quoted 7 lines

There wasn't an MPOL_LOCAL when I introduced either of these flags, it's an oversight to allow them to be passed.

Want to try to update set_mempolicy(2) with the procedure outlined in
https://www.kernel.org/doc/man-pages/patches.html as well?

Yes, why not ? I'll put a note about it.

--
Piotr Kwapulinski

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 7 lines · Piotr Kwapulinski
Quoted 5 lines

There wasn't an MPOL_LOCAL when I introduced either of these flags, it's an oversight to allow them to be passed.

Want to try to update set_mempolicy(2) with the procedure outlined in
https://www.kernel.org/doc/man-pages/patches.html as well?

Yes, why not ? I'll put a note about it.

Thanks! While you're hacking on this area and everything is familiar to you, I'm sure the man page would benefit from as extensive update as you're willing to do.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw

cover man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

The MPOL_LOCAL mode has been implemented by Peter Zijlstra <[email protected]> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode.

---
 man2/mbind.2         | 16 ++++++++++++----
 man2/set_mempolicy.2 | 11 ++++++++++-
 2 files changed, 22 insertions(+), 5 deletions(-)
man2/mbind.2 +12 -4
index 3ea24f6..b184f4e 100644
@@ -130,8 +130,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All policy modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -258,9 +259,14 @@ and
 .I maxnode
 arguments specify the empty set, then the memory is allocated on
 the node of the CPU that triggered the allocation.
-This is the only way to specify "local allocation" for a
-range of memory via
-.BR mbind ().
+
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation. The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set.
 
 If
 .B MPOL_MF_STRICT
@@ -440,6 +446,8 @@ To select explicit "local allocation" for a memory range,
 specify a
 .I mode
 of
+.B MPOL_LOCAL
+or
 .B MPOL_PREFERRED
 with an empty set of nodes.
 This method will work for
man2/set_mempolicy.2 +10 -1
index 1f02037..5755322 100644
@@ -79,8 +79,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -211,6 +212,14 @@ arguments specify the empty set, then the policy
 specifies "local allocation"
 (like the system default policy discussed above).
 
+.B MPOL_LOCAL
+specifies the "local allocation" (like the system default policy
+discussed above). The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set.
+
 The thread memory policy is preserved across an
 .BR execve (2),
 and is inherited by child threads created using
Signature · 7 lines
2.10.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#7 lore raw

Re: [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

Well the difference between MPOL_DEFAULT and MPOL_LOCAL may be confusing. Mention somewhere in the MPOL_LOCAL description that the policy with MPOL_DEFAULT reverts to the policy of the process and MPOL_LOCAL to try to allocate local? Note that MPOL_LOCAL also will not be local if it just happens that the local node is overallocated. This is usually confusing for newcomers. The node/zone reclaim must be activated in order to allow node local reclaim that results in a node local allocation.

#8 lore raw

v2 cover man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

The MPOL_LOCAL mode has been implemented by
Peter Zijlstra <a.p.zijlstra-/NLkJaSkS4VmR6Xm/[email protected]> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8).
Add the documentation for this mode.

---
This version adds more details about MPOL_LOCAL mode:
1. difference between MPOL_LOCAL and MPOL_DEFAULT
2. what if local node is overallocated or not allowed by the cpuset

---
 man2/mbind.2         | 28 ++++++++++++++++++++++++----
 man2/set_mempolicy.2 | 19 ++++++++++++++++++-
 2 files changed, 42 insertions(+), 5 deletions(-)
man2/mbind.2 +24 -4
index 3ea24f6..1dbda1e 100644
@@ -130,8 +130,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All policy modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -258,9 +259,26 @@ and
 .I maxnode
 arguments specify the empty set, then the memory is allocated on
 the node of the CPU that triggered the allocation.
-This is the only way to specify "local allocation" for a
-range of memory via
-.BR mbind ().
+
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever the memory for this node will be released. If the
+"local node" is not allowed by the process's current cpuset context
+the kernel will try to allocate memory from other nodes. The kernel
+will allocate memory from the "local node" whenever it becomes
+allowed by the process's current cpuset context. In contrast
+.B MPOL_DEFAULT
+reverts to the policy of the process which may have been set with
+.BR set_mempolicy (2).
+It may not be the "local allocation".
 
 If
 .B MPOL_MF_STRICT
@@ -440,6 +458,8 @@ To select explicit "local allocation" for a memory range,
 specify a
 .I mode
 of
+.B MPOL_LOCAL
+or
 .B MPOL_PREFERRED
 with an empty set of nodes.
 This method will work for
man2/set_mempolicy.2 +18 -1
index 1f02037..3592734 100644
@@ -79,8 +79,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -211,6 +212,22 @@ arguments specify the empty set, then the policy
 specifies "local allocation"
 (like the system default policy discussed above).
 
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever the memory for this node will be released. If the
+"local node" is not allowed by the process's current cpuset context
+the kernel will try to allocate memory from other nodes. The kernel
+will allocate memory from the "local node" whenever it becomes
+allowed by the process's current cpuset context.
+
 The thread memory policy is preserved across an
 .BR execve (2),
 and is inherited by child threads created using
Signature · 1 line
2.10.0
Reviewed-by on the v2 series
#9 lore raw

Re: [PATCH v2 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

man2/mbind.2 and · line 273

Quoted 4 lines · Piotr Kwapulinski
man2/mbind.2 +4 -0
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever the memory for this node will be released. If the

"whenever memory for this node is available"?

Otherwise

#10 lore raw

v3 cover man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

The MPOL_LOCAL mode has been implemented by Peter Zijlstra <[email protected]> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode.

---
This version fixes grammar

---
 man2/mbind.2         | 28 ++++++++++++++++++++++++----
 man2/set_mempolicy.2 | 19 ++++++++++++++++++-
 2 files changed, 42 insertions(+), 5 deletions(-)
man2/mbind.2 +24 -4
index 3ea24f6..854580c 100644
@@ -130,8 +130,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All policy modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -258,9 +259,26 @@ and
 .I maxnode
 arguments specify the empty set, then the memory is allocated on
 the node of the CPU that triggered the allocation.
-This is the only way to specify "local allocation" for a
-range of memory via
-.BR mbind ().
+
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context. In contrast
+.B MPOL_DEFAULT
+reverts to the policy of the process which may have been set with
+.BR set_mempolicy (2).
+It may not be the "local allocation".
 
 If
 .B MPOL_MF_STRICT
@@ -440,6 +458,8 @@ To select explicit "local allocation" for a memory range,
 specify a
 .I mode
 of
+.B MPOL_LOCAL
+or
 .B MPOL_PREFERRED
 with an empty set of nodes.
 This method will work for
man2/set_mempolicy.2 +18 -1
index 1f02037..22b0f7c 100644
@@ -79,8 +79,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -211,6 +212,22 @@ arguments specify the empty set, then the policy
 specifies "local allocation"
 (like the system default policy discussed above).
 
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context.
+
 The thread memory policy is preserved across an
 .BR execve (2),
 and is inherited by child threads created using
Signature · 1 line
2.10.0
#11 lore raw

Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

Hello Piotr,

Quoted 4 lines · Piotr Kwapulinski

The MPOL_LOCAL mode has been implemented by Peter Zijlstra <[email protected]> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode.

Thanks. I've applied this patch. I have a question below.

Quoted 40 lines

---
This version fixes grammar

---
 man2/mbind.2         | 28 ++++++++++++++++++++++++----
 man2/set_mempolicy.2 | 19 ++++++++++++++++++-
 2 files changed, 42 insertions(+), 5 deletions(-)
man2/mbind.2 +12 -4
index 3ea24f6..854580c 100644
@@ -130,8 +130,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All policy modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -258,9 +259,26 @@ and
 .I maxnode
 arguments specify the empty set, then the memory is allocated on
 the node of the CPU that triggered the allocation.
-This is the only way to specify "local allocation" for a
-range of memory via
-.BR mbind ().
+
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other

man2/mbind.2 and · line 281

Quoted 10 lines
man2/mbind.2 +10 -0
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context. In contrast
+.B MPOL_DEFAULT
+reverts to the policy of the process which may have been set with
+.BR set_mempolicy (2).
+It may not be the "local allocation".

What is the sense of "may not be" here? (And repeated below). Is the meaning "this could be something other than"? Presumably the answer is yes, in which case I'll clarify the wording there. Let me know.

Cheers,

Michael

Quoted 51 lines
man2/mbind.2 +2 -0
 If
 .B MPOL_MF_STRICT
@@ -440,6 +458,8 @@ To select explicit "local allocation" for a memory range,
 specify a
 .I mode
 of
+.B MPOL_LOCAL
+or
 .B MPOL_PREFERRED
 with an empty set of nodes.
 This method will work for
man2/set_mempolicy.2 +18 -1
index 1f02037..22b0f7c 100644
@@ -79,8 +79,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -211,6 +212,22 @@ arguments specify the empty set, then the policy
 specifies "local allocation"
 (like the system default policy discussed above).
 
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context.
+
 The thread memory policy is preserved across an
 .BR execve (2),
 and is inherited by child threads created using
Signature · 9 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#12 lore raw

Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

Quoted 9 lines · Michael Kerrisk (man-pages)
Quoted 9 lines
man2/mbind.2 +9 -0
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context. In contrast
+.B MPOL_DEFAULT
Quoted 8 lines

man2/mbind.2 and · line 281

Quoted 3 lines
man2/mbind.2 +3 -0
+reverts to the policy of the process which may have been set with
+.BR set_mempolicy (2).
+It may not be the "local allocation".

What is the sense of "may not be" here? (And repeated below). Is the meaning "this could be something other than"? Presumably the answer is yes, in which case I'll clarify the wording there. Let me know.

Someone may have set for example a round robin policy with numactl --interleave before starting the process? Then allocations will go through all nodes.

#13 lore raw

Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

Hi Christoph,

Quoted 20 lines · Christoph Lameter
Quoted 9 lines · Michael Kerrisk (man-pages)
Quoted 9 lines
man2/mbind.2 +9 -0
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context. In contrast
+.B MPOL_DEFAULT
Quoted 8 lines

man2/mbind.2 and · line 281

Quoted 3 lines
man2/mbind.2 +3 -0
+reverts to the policy of the process which may have been set with
+.BR set_mempolicy (2).
+It may not be the "local allocation".

What is the sense of "may not be" here? (And repeated below). Is the meaning "this could be something other than"? Presumably the answer is yes, in which case I'll clarify the wording there. Let me know.

Quoted 3 lines

Someone may have set for example a round robin policy with numactl --interleave before starting the process? Then allocations will go through all nodes.

So the sense is then "this could be something other than", right?

Cheers,

Michael

Signature · 9 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#14 lore raw

Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

In reply to Michael Kerrisk (man-pages)

Hi Michael,

Quoted 66 lines · Michael Kerrisk (man-pages)

Hello Piotr,

Quoted 4 lines · Piotr Kwapulinski

The MPOL_LOCAL mode has been implemented by Peter Zijlstra <[email protected]> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode.

Thanks. I've applied this patch. I have a question below.

Quoted 40 lines

---
This version fixes grammar

---
 man2/mbind.2         | 28 ++++++++++++++++++++++++----
 man2/set_mempolicy.2 | 19 ++++++++++++++++++-
 2 files changed, 42 insertions(+), 5 deletions(-)
man2/mbind.2 +12 -4
index 3ea24f6..854580c 100644
@@ -130,8 +130,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All policy modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -258,9 +259,26 @@ and
 .I maxnode
 arguments specify the empty set, then the memory is allocated on
 the node of the CPU that triggered the allocation.
-This is the only way to specify "local allocation" for a
-range of memory via
-.BR mbind ().
+
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other

man2/mbind.2 and · line 281

Quoted 10 lines
man2/mbind.2 +10 -0
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context. In contrast
+.B MPOL_DEFAULT
+reverts to the policy of the process which may have been set with
+.BR set_mempolicy (2).
+It may not be the "local allocation".

What is the sense of "may not be" here? (And repeated below). Is the meaning "this could be something other than"? Presumably the answer is yes, in which case I'll clarify the wording there. Let me know.

Quoted 4 lines

Cheers,

Michael

That's right. This could be "local allocation" or any other memory policy.

Thanks
Piotr Kwapulinski

Quoted 43 lines
Quoted 43 lines
man2/mbind.2 +2 -0
 If
 .B MPOL_MF_STRICT
@@ -440,6 +458,8 @@ To select explicit "local allocation" for a memory range,
 specify a
 .I mode
 of
+.B MPOL_LOCAL
+or
 .B MPOL_PREFERRED
 with an empty set of nodes.
 This method will work for
man2/set_mempolicy.2 +14 -1
index 1f02037..22b0f7c 100644
@@ -79,8 +79,9 @@ argument must specify one of
 .BR MPOL_DEFAULT ,
 .BR MPOL_BIND ,
 .BR MPOL_INTERLEAVE ,
+.BR MPOL_PREFERRED ,
 or
-.BR MPOL_PREFERRED .
+.BR MPOL_LOCAL .
 All modes except
 .B MPOL_DEFAULT
 require the caller to specify via the
@@ -211,6 +212,22 @@ arguments specify the empty set, then the policy
 specifies "local allocation"
 (like the system default policy discussed above).
 
+.B MPOL_LOCAL
+specifies the "local allocation", the memory is allocated on
+the node of the CPU that triggered the allocation, "local node".
+The
+.I nodemask
+and
+.I maxnode
+arguments must specify the empty set. If the "local node" is low
+on free memory the kernel will try to allocate memory from other
+nodes. The kernel will allocate memory from the "local node"
+whenever memory for this node is available. If the "local node"
+is not allowed by the process's current cpuset context the kernel
Quoted 14 lines
Quoted 8 lines
man2/set_mempolicy.2 +4 -0
+will try to allocate memory from other nodes. The kernel will
+allocate memory from the "local node" whenever it becomes allowed
+by the process's current cpuset context.
+
 The thread memory policy is preserved across an
 .BR execve (2),
 and is inherited by child threads created using
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

--
Piotr Kwapulinski

#16 lore raw

Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation

Quoted 6 lines · Christoph Lameter
Quoted 1 line · Piotr Kwapulinski

That's right. This could be "local allocation" or any other memory policy.

Correct.

Thanks, Piotr and Christoph.

Cheers,

Michael

Signature · 9 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#17 lore raw

PATCH 1/1 mm/mempolicy.c: add MPOL_LOCAL NUMA memory policy documentation

In reply to David Rientjes

The MPOL_LOCAL mode has been implemented by
Peter Zijlstra <a.p.zijlstra-/NLkJaSkS4VmR6Xm/[email protected]> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8).
Add the documentation for this mode.

---
 Documentation/vm/numa_memory_policy.txt | 8 ++++++++
 mm/mempolicy.c                          | 4 ++++
 2 files changed, 12 insertions(+)
Documentation/vm/numa_memory_policy.txt +8 -0
index 622b927..dcb490e 100644
@@ -212,6 +212,14 @@ Components of Memory Policies
 	    the temporary interleaved system default policy works in this
 	    mode.
 
+	MPOL_LOCAL: This mode specifies "local allocation". It must be
+	used along with an empty nodemask. It acts like the MPOL_PREFERRED
+	mode specified with an empty nodemask. For details refer to
+	the MPOL_PREFERRED mode described above.
+
+	    Internally, it is transformed into MPOL_PREFERRED mode with an
+	    empty nodemask.
+
    Linux memory policy supports the following optional mode flags:
 
 	MPOL_F_STATIC_NODES:  This flag specifies that the nodemask passed by
mm/mempolicy.c +4 -0
index 2da72a5..02dc43e 100644
@@ -35,6 +35,10 @@
  *                use the process policy. This is what Linux always did
  *		  in a NUMA aware kernel and still does by, ahem, default.
  *
+ * local          "Local allocation". It acts like a special case of
+ *                "preferred" memory policy: NUMA_NO_NODE (see above
+ *                for details).
+ *
  * The process policy is applied for most non interrupt memory allocations
  * in that process' context. Interrupts ignore the policies and always
  * try to allocate on the local CPU. The VMA policy is only applied for memory
Signature · 1 line
2.10.0
#18 lore raw

v2 cover mm/mempolicy.c: forbid static or relative flags for local NUMA mode

In reply to David Rientjes

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy or mbind.
Return the "invalid argument" from set_mempolicy and mbind whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).
Isolated tests done.

---
Changes since V1:
Adds "mbind" to changelog.
Updates numa_memory_policy.txt.
Based on more recent kernel version.

The following patch updates man-pages:
[PATCH 1/1] man/set_mempolicy.2,mbind.2: forbid static or relative
flags for local NUMA mode
The following patch set adds documentation for MPOL_LOCAL:
[PATCH 0/1] man/set_mempolicy.2,mbind.2: Add MPOL_LOCAL NUMA memory
policy documentation
[PATCH 1/1] mm/mempolicy.c: Add MPOL_LOCAL NUMA memory policy
documentation

---
 Documentation/vm/numa_memory_policy.txt | 8 ++++----
 mm/mempolicy.c                          | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)
Documentation/vm/numa_memory_policy.txt +4 -4
index 622b927..d246c6c 100644
@@ -239,8 +239,8 @@ Components of Memory Policies
 
 	    MPOL_F_STATIC_NODES cannot be combined with the
 	    MPOL_F_RELATIVE_NODES flag.  It also cannot be used for
-	    MPOL_PREFERRED policies that were created with an empty nodemask
-	    (local allocation).
+	    MPOL_LOCAL and MPOL_PREFERRED policies that were created with an
+	    empty nodemask (local allocation).
 
 	MPOL_F_RELATIVE_NODES:  This flag specifies that the nodemask passed
 	by the user will be mapped relative to the set of the task or VMA's
@@ -289,8 +289,8 @@ Components of Memory Policies
 
 	    MPOL_F_RELATIVE_NODES cannot be combined with the
 	    MPOL_F_STATIC_NODES flag.  It also cannot be used for
-	    MPOL_PREFERRED policies that were created with an empty nodemask
-	    (local allocation).
+	    MPOL_LOCAL and MPOL_PREFERRED policies that were created with an
+	    empty nodemask (local allocation).
 
 MEMORY POLICY REFERENCE COUNTING
 
mm/mempolicy.c +3 -1
index 2da72a5..27b07d1 100644
@@ -276,7 +276,9 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
 				return ERR_PTR(-EINVAL);
 		}
 	} else if (mode == MPOL_LOCAL) {
-		if (!nodes_empty(*nodes))
+		if (!nodes_empty(*nodes) ||
+		    (flags & MPOL_F_STATIC_NODES) ||
+		    (flags & MPOL_F_RELATIVE_NODES))
 			return ERR_PTR(-EINVAL);
 		mode = MPOL_PREFERRED;
 	} else if (nodes_empty(*nodes))
Signature · 7 lines
2.10.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#19 lore raw

v3 cover mm/mempolicy.c: forbid static or relative flags for local NUMA mode

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy or mbind.
Return the "invalid argument" from set_mempolicy and mbind whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).
Isolated tests done.

---
Changes since V2:
Information from Documentation/vm/numa_memory_policy.txt removed. Please let me know what else I should do to let this patch to be accepted.

---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mempolicy.c +3 -1
index 0b859af..266893e 100644
@@ -276,7 +276,9 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
 				return ERR_PTR(-EINVAL);
 		}
 	} else if (mode == MPOL_LOCAL) {
-		if (!nodes_empty(*nodes))
+		if (!nodes_empty(*nodes) ||
+		    (flags & MPOL_F_STATIC_NODES) ||
+		    (flags & MPOL_F_RELATIVE_NODES))
 			return ERR_PTR(-EINVAL);
 		mode = MPOL_PREFERRED;
 	} else if (nodes_empty(*nodes))
Signature · 7 lines
2.10.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on the v3 series
#20 lore raw
Quoted 12 lines · Piotr Kwapulinski

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy or mbind.
Return the "invalid argument" from set_mempolicy and mbind whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).
Isolated tests done.

Quoted 1 line
#21 lore raw

PATCH v2 1/1 man/set_mempolicy.2,mbind.2: forbid static or relative flags for local NUMA mode

In reply to David Rientjes

Add documentation for the following patch:
[PATCH v2 0/1] mm/mempolicy.c: forbid static or relative flags
for local NUMA mode

---
 man2/mbind.2         | 35 +++++++++++++++++++++++++++++++++++
 man2/set_mempolicy.2 | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
man2/mbind.2 +35 -0
index 3ea24f6..8c50948 100644
@@ -375,6 +375,41 @@ argument specified both
 .B MPOL_F_STATIC_NODES
 and
 .BR MPOL_F_RELATIVE_NODES .
+Or, the
+.I mode
+argument specifies
+.B MPOL_PREFERRED
+and
+.B MPOL_F_STATIC_NODES
+flag and
+.I nodemask
+is empty. Or, the
+.I mode
+argument specifies
+.B MPOL_PREFERRED
+and
+.B MPOL_F_RELATIVE_NODES
+flag and
+.I nodemask
+is empty. Or, the
+.I mode
+is
+.B MPOL_LOCAL
+and
+.I nodemask
+is empty. Or, the
+.I mode
+argument specifies
+.B MPOL_LOCAL
+and
+.B MPOL_F_STATIC_NODES
+flag. Or, the
+.I mode
+argument specifies
+.B MPOL_LOCAL
+and
+.B MPOL_F_RELATIVE_NODES
+flag.
 .TP
 .B EIO
 .B MPOL_MF_STRICT
man2/set_mempolicy.2 +35 -0
index 1f02037..9204941 100644
@@ -269,6 +269,41 @@ argument specified both
 .B MPOL_F_STATIC_NODES
 and
 .BR MPOL_F_RELATIVE_NODES .
+Or, the
+.I mode
+argument specifies
+.B MPOL_PREFERRED
+and
+.B MPOL_F_STATIC_NODES
+flag and
+.I nodemask
+is empty. Or, the
+.I mode
+argument specifies
+.B MPOL_PREFERRED
+and
+.B MPOL_F_RELATIVE_NODES
+flag and
+.I nodemask
+is empty. Or, the
+.I mode
+is
+.B MPOL_LOCAL
+and
+.I nodemask
+is empty. Or, the
+.I mode
+argument specifies
+.B MPOL_LOCAL
+and
+.B MPOL_F_STATIC_NODES
+flag. Or, the
+.I mode
+argument specifies
+.B MPOL_LOCAL
+and
+.B MPOL_F_RELATIVE_NODES
+flag.
 .TP
 .B ENOMEM
 Insufficient kernel memory was available.
Signature · 1 line
2.10.0
#22 lore raw
In reply to Piotr Kwapulinski

[CC += [email protected]]

Since this is a kernel-user-space API change, please CC linux-api@. The
kernel source file Documentation/SubmitChecklist notes that all Linux kernel patches that change userspace interfaces should be CCed to [email protected], so that the various parties who are interested in API changes are informed. For further information, see https://www.kernel.org/doc/man-pages/linux-api-ml.html

I think man page should document the change? Also I noticed that MPOL_NUMA itself is missing in the man page...

Quoted 9 lines · Piotr Kwapulinski

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy. Return the "invalid argument" from set_mempolicy whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It also slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).

Hmm not sure I understand. How does change in mpol_new() affect mpol_rebind_preferred()?

Vlastimil

Quoted 23 lines

Isolated tests done.

---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mempolicy.c +3 -1
index 2da72a5..27b07d1 100644
@@ -276,7 +276,9 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
 				return ERR_PTR(-EINVAL);
 		}
 	} else if (mode == MPOL_LOCAL) {
-		if (!nodes_empty(*nodes))
+		if (!nodes_empty(*nodes) ||
+		    (flags & MPOL_F_STATIC_NODES) ||
+		    (flags & MPOL_F_RELATIVE_NODES))
 			return ERR_PTR(-EINVAL);
 		mode = MPOL_PREFERRED;
 	} else if (nodes_empty(*nodes))
#23 lore raw
Quoted 23 lines · Vlastimil Babka

[CC += [email protected]]

Since this is a kernel-user-space API change, please CC linux-api@. The
kernel source file Documentation/SubmitChecklist notes that all Linux kernel patches that change userspace interfaces should be CCed to [email protected], so that the various parties who are interested in API changes are informed. For further information, see
https://www.kernel.org/doc/man-pages/linux-api-ml.html

I think man page should document the change? Also I noticed that MPOL_NUMA itself is missing in the man page...

Quoted 9 lines · Piotr Kwapulinski

The MPOL_F_STATIC_NODES and MPOL_F_RELATIVE_NODES flags are irrelevant when setting them for MPOL_LOCAL NUMA memory policy via set_mempolicy. Return the "invalid argument" from set_mempolicy whenever any of these flags is passed along with MPOL_LOCAL.
It is consistent with MPOL_PREFERRED passed with empty nodemask. It also slightly shortens the execution time in paths where these flags are used e.g. when trying to rebind the NUMA nodes for changes in cgroups cpuset mems (mpol_rebind_preferred()) or when just printing the mempolicy structure (/proc/PID/numa_maps).

Quoted 2 lines

Hmm not sure I understand. How does change in mpol_new() affect mpol_rebind_preferred()?

When MPOL_LOCAL is passed to set_mempolicy along with empty nodemask it is transformed into MPOL_PREFERRED (inside mpol_new()). Unlike MPOL_PREFERRED the MPOL_LOCAL may be set along with MPOL_F_STATIC_NODES or MPOL_F_RELATIVE_NODES flag (inconsistency). Later on when the set of allowed NUMA nodes is changed by cgroups cpuset.mems the mpol_rebind_preferred() is called. Because one of the flags is set the unnecessary code is executed. The same is for mpol_to_str().

Quoted 10 lines

Vlastimil

Quoted 7 lines

Isolated tests done.

---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 17 lines
Quoted 6 lines
mm/mempolicy.c +0 -0
index 2da72a5..27b07d1 100644

mm/mempolicy.c static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags, · line 284

Quoted 10 lines
mm/mempolicy.c +3 -1
@@ -276,7 +276,9 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
 				return ERR_PTR(-EINVAL);
 		}
 	} else if (mode == MPOL_LOCAL) {
-		if (!nodes_empty(*nodes))
+		if (!nodes_empty(*nodes) ||
+		    (flags & MPOL_F_STATIC_NODES) ||
+		    (flags & MPOL_F_RELATIVE_NODES))
 			return ERR_PTR(-EINVAL);
 		mode = MPOL_PREFERRED;
 	} else if (nodes_empty(*nodes))

--
Piotr Kwapulinski

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>