* [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation [not found] <alpine.DEB.2.10.1609201304450.134671@chino.kir.corp.google.com> @ 2016-09-27 13:19 ` Piotr Kwapulinski [not found] ` <20160927131948.11974-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [not found] ` <alpine.DEB.2.10.1609201304450.134671-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org> 2016-09-27 13:25 ` [PATCH v2 0/1] mm/mempolicy.c: " Piotr Kwapulinski 2 siblings, 1 reply; 16+ messages in thread From: Piotr Kwapulinski @ 2016-09-27 13:19 UTC (permalink / raw) To: mtk.manpages Cc: kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, cl, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api, kwapulinski.piotr The MPOL_LOCAL mode has been implemented by Peter Zijlstra <a.p.zijlstra@chello.nl> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode. Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com> --- man2/mbind.2 | 16 ++++++++++++---- man2/set_mempolicy.2 | 11 ++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/man2/mbind.2 b/man2/mbind.2 index 3ea24f6..b184f4e 100644 --- a/man2/mbind.2 +++ b/man2/mbind.2 @@ -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 diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 index 1f02037..5755322 100644 --- a/man2/set_mempolicy.2 +++ b/man2/set_mempolicy.2 @@ -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 -- 2.10.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply related [flat|nested] 16+ messages in thread
[parent not found: <20160927131948.11974-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation [not found] ` <20160927131948.11974-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-10-04 8:36 ` Christoph Lameter [not found] ` <alpine.DEB.2.20.1610040333050.10814-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org> 0 siblings, 1 reply; 16+ messages in thread From: Christoph Lameter @ 2016-10-04 8:36 UTC (permalink / raw) To: Piotr Kwapulinski Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, kirill.shutemov-VuQAYsv1563Yd54FQh9/CA, vbabka-AlSwsSmVLrQ, rientjes-hpIqsD4AKlfQT0dZR+AlfA, mhocko-DgEjT+Ai2ygdnm+yROfE0A, mgorman-3eNAlZScCAx27rWaFMvyedHuzzzSOjJt, liangchen.linux-Re5JQEeQqe8AvxtiuMwx3w, nzimmer-sJ/iWh9BUns, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw, riel-H+wXaHxf7aLQT0dZR+AlfA, lee.schermerhorn-VXdhtT5mjnY, jmarchan-H+wXaHxf7aLQT0dZR+AlfA, joe-6d6DIl74uiNBDgjK7y7TUQ, corbet-T1hC0tSOHrs, iamyooon-Re5JQEeQqe8AvxtiuMwx3w, n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-man-u79uwXL29TY76Z2rM5mHXA, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA 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. ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <alpine.DEB.2.20.1610040333050.10814-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>]
* [PATCH v2 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation [not found] ` <alpine.DEB.2.20.1610040333050.10814-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org> @ 2016-10-09 18:56 ` Piotr Kwapulinski 2016-10-10 13:55 ` Christoph Lameter 0 siblings, 1 reply; 16+ messages in thread From: Piotr Kwapulinski @ 2016-10-09 18:56 UTC (permalink / raw) To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w Cc: kirill.shutemov-VuQAYsv1563Yd54FQh9/CA, vbabka-AlSwsSmVLrQ, rientjes-hpIqsD4AKlfQT0dZR+AlfA, mhocko-DgEjT+Ai2ygdnm+yROfE0A, mgorman-3eNAlZScCAx27rWaFMvyedHuzzzSOjJt, liangchen.linux-Re5JQEeQqe8AvxtiuMwx3w, nzimmer-sJ/iWh9BUns, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw, cl-vYTEC60ixJUAvxtiuMwx3w, riel-H+wXaHxf7aLQT0dZR+AlfA, lee.schermerhorn-VXdhtT5mjnY, jmarchan-H+wXaHxf7aLQT0dZR+AlfA, joe-6d6DIl74uiNBDgjK7y7TUQ, corbet-T1hC0tSOHrs, iamyooon-Re5JQEeQqe8AvxtiuMwx3w, n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-man-u79uwXL29TY76Z2rM5mHXA, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA, kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w The MPOL_LOCAL mode has been implemented by Peter Zijlstra <a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw@public.gmane.org> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode. Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- 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(-) diff --git a/man2/mbind.2 b/man2/mbind.2 index 3ea24f6..1dbda1e 100644 --- a/man2/mbind.2 +++ b/man2/mbind.2 @@ -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 diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 index 1f02037..3592734 100644 --- a/man2/set_mempolicy.2 +++ b/man2/set_mempolicy.2 @@ -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 -- 2.10.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-09 18:56 ` [PATCH v2 " Piotr Kwapulinski @ 2016-10-10 13:55 ` Christoph Lameter 2016-10-10 16:23 ` [PATCH v3 " Piotr Kwapulinski 0 siblings, 1 reply; 16+ messages in thread From: Christoph Lameter @ 2016-10-10 13:55 UTC (permalink / raw) To: Piotr Kwapulinski Cc: mtk.manpages, kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api On Sun, 9 Oct 2016, Piotr Kwapulinski wrote: > +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 Reviewed-by: Christoph Lameter <cl@linux.com> ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-10 13:55 ` Christoph Lameter @ 2016-10-10 16:23 ` Piotr Kwapulinski 2016-10-12 7:55 ` Michael Kerrisk (man-pages) 0 siblings, 1 reply; 16+ messages in thread From: Piotr Kwapulinski @ 2016-10-10 16:23 UTC (permalink / raw) To: mtk.manpages Cc: kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, cl, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api, kwapulinski.piotr The MPOL_LOCAL mode has been implemented by Peter Zijlstra <a.p.zijlstra@chello.nl> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode. Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com> --- This version fixes grammar --- man2/mbind.2 | 28 ++++++++++++++++++++++++---- man2/set_mempolicy.2 | 19 ++++++++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/man2/mbind.2 b/man2/mbind.2 index 3ea24f6..854580c 100644 --- a/man2/mbind.2 +++ b/man2/mbind.2 @@ -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 diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 index 1f02037..22b0f7c 100644 --- a/man2/set_mempolicy.2 +++ b/man2/set_mempolicy.2 @@ -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 -- 2.10.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-10 16:23 ` [PATCH v3 " Piotr Kwapulinski @ 2016-10-12 7:55 ` Michael Kerrisk (man-pages) 2016-10-12 14:08 ` Christoph Lameter 2016-10-12 15:53 ` Piotr Kwapulinski 0 siblings, 2 replies; 16+ messages in thread From: Michael Kerrisk (man-pages) @ 2016-10-12 7:55 UTC (permalink / raw) To: Piotr Kwapulinski Cc: mtk.manpages, kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, cl, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api Hello Piotr, On 10/10/2016 06:23 PM, Piotr Kwapulinski wrote: > The MPOL_LOCAL mode has been implemented by > Peter Zijlstra <a.p.zijlstra@chello.nl> > (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). > Add the documentation for this mode. Thanks. I've applied this patch. I have a question below. > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com> > --- > This version fixes grammar > --- > man2/mbind.2 | 28 ++++++++++++++++++++++++---- > man2/set_mempolicy.2 | 19 ++++++++++++++++++- > 2 files changed, 42 insertions(+), 5 deletions(-) > > diff --git a/man2/mbind.2 b/man2/mbind.2 > index 3ea24f6..854580c 100644 > --- a/man2/mbind.2 > +++ b/man2/mbind.2 > @@ -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". 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 > > 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 > diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 > index 1f02037..22b0f7c 100644 > --- a/man2/set_mempolicy.2 > +++ b/man2/set_mempolicy.2 > @@ -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 > -- 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 majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-12 7:55 ` Michael Kerrisk (man-pages) @ 2016-10-12 14:08 ` Christoph Lameter 2016-10-12 14:35 ` Michael Kerrisk (man-pages) 2016-10-12 15:53 ` Piotr Kwapulinski 1 sibling, 1 reply; 16+ messages in thread From: Christoph Lameter @ 2016-10-12 14:08 UTC (permalink / raw) To: Michael Kerrisk (man-pages) Cc: Piotr Kwapulinski, kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api On Wed, 12 Oct 2016, Michael Kerrisk (man-pages) wrote: > > +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". > > 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. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-12 14:08 ` Christoph Lameter @ 2016-10-12 14:35 ` Michael Kerrisk (man-pages) 0 siblings, 0 replies; 16+ messages in thread From: Michael Kerrisk (man-pages) @ 2016-10-12 14:35 UTC (permalink / raw) To: Christoph Lameter Cc: Piotr Kwapulinski, Kirill A. Shutemov, Vlastimil Babka, David Rientjes, mhocko, mgorman, Liang Chen, nzimmer, Peter Zijlstra, Rik van Riel, Lee Schermerhorn, jmarchan, Joe Perches, Jonathan Corbet, SeokHoon Yoon, n-horiguchi, linux-mm@kvack.org, lkml, linux-man, Andrew Morton, linux-doc, Linux API Hi Christoph, On 12 October 2016 at 16:08, Christoph Lameter <cl@linux.com> wrote: > On Wed, 12 Oct 2016, Michael Kerrisk (man-pages) wrote: > >> > +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". >> >> 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. So the sense is then "this could be something other than", right? Cheers, Michael -- 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 majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-12 7:55 ` Michael Kerrisk (man-pages) 2016-10-12 14:08 ` Christoph Lameter @ 2016-10-12 15:53 ` Piotr Kwapulinski 2016-10-12 19:55 ` Christoph Lameter 1 sibling, 1 reply; 16+ messages in thread From: Piotr Kwapulinski @ 2016-10-12 15:53 UTC (permalink / raw) To: Michael Kerrisk (man-pages) Cc: kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, cl, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api Hi Michael, On Wed, Oct 12, 2016 at 09:55:16AM +0200, Michael Kerrisk (man-pages) wrote: > Hello Piotr, > > On 10/10/2016 06:23 PM, Piotr Kwapulinski wrote: > > The MPOL_LOCAL mode has been implemented by > > Peter Zijlstra <a.p.zijlstra@chello.nl> > > (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). > > Add the documentation for this mode. > > Thanks. I've applied this patch. I have a question below. > > > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com> > > --- > > This version fixes grammar > > --- > > man2/mbind.2 | 28 ++++++++++++++++++++++++---- > > man2/set_mempolicy.2 | 19 ++++++++++++++++++- > > 2 files changed, 42 insertions(+), 5 deletions(-) > > > > diff --git a/man2/mbind.2 b/man2/mbind.2 > > index 3ea24f6..854580c 100644 > > --- a/man2/mbind.2 > > +++ b/man2/mbind.2 > > @@ -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". > > 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 > That's right. This could be "local allocation" or any other memory policy. Thanks Piotr Kwapulinski > > > > 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 > > diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 > > index 1f02037..22b0f7c 100644 > > --- a/man2/set_mempolicy.2 > > +++ b/man2/set_mempolicy.2 > > @@ -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 > > > > > -- > Michael Kerrisk > Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ > Linux/UNIX System Programming Training: http://man7.org/training/ -- Piotr Kwapulinski ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-12 15:53 ` Piotr Kwapulinski @ 2016-10-12 19:55 ` Christoph Lameter 2016-10-13 6:48 ` Michael Kerrisk (man-pages) 0 siblings, 1 reply; 16+ messages in thread From: Christoph Lameter @ 2016-10-12 19:55 UTC (permalink / raw) To: Piotr Kwapulinski Cc: Michael Kerrisk (man-pages), kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api On Wed, 12 Oct 2016, Piotr Kwapulinski wrote: > That's right. This could be "local allocation" or any other memory policy. Correct. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation 2016-10-12 19:55 ` Christoph Lameter @ 2016-10-13 6:48 ` Michael Kerrisk (man-pages) 0 siblings, 0 replies; 16+ messages in thread From: Michael Kerrisk (man-pages) @ 2016-10-13 6:48 UTC (permalink / raw) To: Christoph Lameter, Piotr Kwapulinski Cc: mtk.manpages, kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, akpm, linux-doc, linux-api On 10/12/2016 09:55 PM, Christoph Lameter wrote: > On Wed, 12 Oct 2016, Piotr Kwapulinski wrote: > >> That's right. This could be "local allocation" or any other memory policy. > > Correct. > Thanks, Piotr and Christoph. Cheers, Michael -- 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 majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <alpine.DEB.2.10.1609201304450.134671-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>]
* [PATCH 1/1] mm/mempolicy.c: add MPOL_LOCAL NUMA memory policy documentation [not found] ` <alpine.DEB.2.10.1609201304450.134671-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org> @ 2016-09-27 13:22 ` Piotr Kwapulinski 2016-09-27 13:27 ` [PATCH 1/1] man/set_mempolicy.2,mbind.2: forbid static or relative flags for local NUMA mode Piotr Kwapulinski 1 sibling, 0 replies; 16+ messages in thread From: Piotr Kwapulinski @ 2016-09-27 13:22 UTC (permalink / raw) To: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b Cc: kirill.shutemov-VuQAYsv1563Yd54FQh9/CA, vbabka-AlSwsSmVLrQ, rientjes-hpIqsD4AKlfQT0dZR+AlfA, mhocko-DgEjT+Ai2ygdnm+yROfE0A, mgorman-3eNAlZScCAx27rWaFMvyedHuzzzSOjJt, liangchen.linux-Re5JQEeQqe8AvxtiuMwx3w, nzimmer-sJ/iWh9BUns, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw, cl-vYTEC60ixJUAvxtiuMwx3w, riel-H+wXaHxf7aLQT0dZR+AlfA, lee.schermerhorn-VXdhtT5mjnY, jmarchan-H+wXaHxf7aLQT0dZR+AlfA, joe-6d6DIl74uiNBDgjK7y7TUQ, corbet-T1hC0tSOHrs, iamyooon-Re5JQEeQqe8AvxtiuMwx3w, n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-man-u79uwXL29TY76Z2rM5mHXA, mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA, kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w The MPOL_LOCAL mode has been implemented by Peter Zijlstra <a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw@public.gmane.org> (commit: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8). Add the documentation for this mode. Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- Documentation/vm/numa_memory_policy.txt | 8 ++++++++ mm/mempolicy.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/Documentation/vm/numa_memory_policy.txt b/Documentation/vm/numa_memory_policy.txt index 622b927..dcb490e 100644 --- a/Documentation/vm/numa_memory_policy.txt +++ b/Documentation/vm/numa_memory_policy.txt @@ -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 diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 2da72a5..02dc43e 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -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 -- 2.10.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/1] man/set_mempolicy.2,mbind.2: forbid static or relative flags for local NUMA mode [not found] ` <alpine.DEB.2.10.1609201304450.134671-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org> 2016-09-27 13:22 ` [PATCH 1/1] mm/mempolicy.c: " Piotr Kwapulinski @ 2016-09-27 13:27 ` Piotr Kwapulinski 1 sibling, 0 replies; 16+ messages in thread From: Piotr Kwapulinski @ 2016-09-27 13:27 UTC (permalink / raw) To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w Cc: kirill.shutemov-VuQAYsv1563Yd54FQh9/CA, vbabka-AlSwsSmVLrQ, rientjes-hpIqsD4AKlfQT0dZR+AlfA, mhocko-DgEjT+Ai2ygdnm+yROfE0A, mgorman-3eNAlZScCAx27rWaFMvyedHuzzzSOjJt, liangchen.linux-Re5JQEeQqe8AvxtiuMwx3w, nzimmer-sJ/iWh9BUns, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw, cl-vYTEC60ixJUAvxtiuMwx3w, riel-H+wXaHxf7aLQT0dZR+AlfA, lee.schermerhorn-VXdhtT5mjnY, jmarchan-H+wXaHxf7aLQT0dZR+AlfA, joe-6d6DIl74uiNBDgjK7y7TUQ, corbet-T1hC0tSOHrs, iamyooon-Re5JQEeQqe8AvxtiuMwx3w, n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-man-u79uwXL29TY76Z2rM5mHXA, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA, kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w Add documentation for the following patch: [PATCH v2 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- man2/mbind.2 | 35 +++++++++++++++++++++++++++++++++++ man2/set_mempolicy.2 | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/man2/mbind.2 b/man2/mbind.2 index 3ea24f6..8c50948 100644 --- a/man2/mbind.2 +++ b/man2/mbind.2 @@ -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 diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 index 1f02037..9204941 100644 --- a/man2/set_mempolicy.2 +++ b/man2/set_mempolicy.2 @@ -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. -- 2.10.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode [not found] <alpine.DEB.2.10.1609201304450.134671@chino.kir.corp.google.com> 2016-09-27 13:19 ` [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation Piotr Kwapulinski [not found] ` <alpine.DEB.2.10.1609201304450.134671-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org> @ 2016-09-27 13:25 ` Piotr Kwapulinski 2016-10-27 16:30 ` [PATCH v3 " Piotr Kwapulinski 2 siblings, 1 reply; 16+ messages in thread From: Piotr Kwapulinski @ 2016-09-27 13:25 UTC (permalink / raw) To: akpm Cc: kirill.shutemov, vbabka, rientjes, mhocko, mgorman, liangchen.linux, nzimmer, a.p.zijlstra, cl, riel, lee.schermerhorn, jmarchan, joe, corbet, iamyooon, n-horiguchi, linux-mm, linux-kernel, linux-man, mtk.manpages, linux-doc, linux-api, kwapulinski.piotr 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. Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com> --- 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(-) diff --git a/Documentation/vm/numa_memory_policy.txt b/Documentation/vm/numa_memory_policy.txt index 622b927..d246c6c 100644 --- a/Documentation/vm/numa_memory_policy.txt +++ b/Documentation/vm/numa_memory_policy.txt @@ -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 diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 2da72a5..27b07d1 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -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)) -- 2.10.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode 2016-09-27 13:25 ` [PATCH v2 0/1] mm/mempolicy.c: " Piotr Kwapulinski @ 2016-10-27 16:30 ` Piotr Kwapulinski [not found] ` <20161027163037.4089-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 16+ messages in thread From: Piotr Kwapulinski @ 2016-10-27 16:30 UTC (permalink / raw) To: akpm Cc: kirill.shutemov, vbabka, rientjes, mhocko, liangchen.linux, mgorman, dave.hansen, nzimmer, linux-mm, linux-kernel, linux-api, kwapulinski.piotr 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. Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com> --- 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(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 0b859af..266893e 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -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)) -- 2.10.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply related [flat|nested] 16+ messages in thread
[parent not found: <20161027163037.4089-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v3 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode [not found] ` <20161027163037.4089-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-11-01 0:21 ` David Rientjes 0 siblings, 0 replies; 16+ messages in thread From: David Rientjes @ 2016-11-01 0:21 UTC (permalink / raw) To: Piotr Kwapulinski Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, kirill.shutemov-VuQAYsv1563Yd54FQh9/CA, vbabka-AlSwsSmVLrQ, mhocko-IBi9RG/b67k, liangchen.linux-Re5JQEeQqe8AvxtiuMwx3w, mgorman-3eNAlZScCAx27rWaFMvyedHuzzzSOjJt, dave.hansen-VuQAYsv1563Yd54FQh9/CA, nzimmer-sJ/iWh9BUns, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA On Thu, 27 Oct 2016, Piotr Kwapulinski wrote: > 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. > > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Acked-by: David Rientjes <rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-11-01 0:21 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <alpine.DEB.2.10.1609201304450.134671@chino.kir.corp.google.com> 2016-09-27 13:19 ` [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation Piotr Kwapulinski [not found] ` <20160927131948.11974-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-10-04 8:36 ` Christoph Lameter [not found] ` <alpine.DEB.2.20.1610040333050.10814-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org> 2016-10-09 18:56 ` [PATCH v2 " Piotr Kwapulinski 2016-10-10 13:55 ` Christoph Lameter 2016-10-10 16:23 ` [PATCH v3 " Piotr Kwapulinski 2016-10-12 7:55 ` Michael Kerrisk (man-pages) 2016-10-12 14:08 ` Christoph Lameter 2016-10-12 14:35 ` Michael Kerrisk (man-pages) 2016-10-12 15:53 ` Piotr Kwapulinski 2016-10-12 19:55 ` Christoph Lameter 2016-10-13 6:48 ` Michael Kerrisk (man-pages) [not found] ` <alpine.DEB.2.10.1609201304450.134671-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org> 2016-09-27 13:22 ` [PATCH 1/1] mm/mempolicy.c: " Piotr Kwapulinski 2016-09-27 13:27 ` [PATCH 1/1] man/set_mempolicy.2,mbind.2: forbid static or relative flags for local NUMA mode Piotr Kwapulinski 2016-09-27 13:25 ` [PATCH v2 0/1] mm/mempolicy.c: " Piotr Kwapulinski 2016-10-27 16:30 ` [PATCH v3 " Piotr Kwapulinski [not found] ` <20161027163037.4089-1-kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-11-01 0:21 ` David Rientjes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).