All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-18 11:29 ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-18 11:29 UTC (permalink / raw)
  To: akpm
  Cc: kirill.shutemov, vbabka, rientjes, mhocko, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel,
	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.
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.

Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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.9.2

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-18 11:29 ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-18 11:29 UTC (permalink / raw)
  To: akpm
  Cc: kirill.shutemov, vbabka, rientjes, mhocko, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel,
	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.
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.

Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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.9.2

--
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] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-18 11:29 ` Piotr Kwapulinski
@ 2016-09-19 11:52   ` Michal Hocko
  -1 siblings, 0 replies; 54+ messages in thread
From: Michal Hocko @ 2016-09-19 11:52 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, rientjes, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel

On Sun 18-09-16 13:29:43, 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.
> 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?

> 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)

> Isolated tests done.
> 
> Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> ---
>  mm/mempolicy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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.9.2

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-19 11:52   ` Michal Hocko
  0 siblings, 0 replies; 54+ messages in thread
From: Michal Hocko @ 2016-09-19 11:52 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, rientjes, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel

On Sun 18-09-16 13:29:43, 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.
> 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?

> 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)

> Isolated tests done.
> 
> Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> ---
>  mm/mempolicy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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.9.2

-- 
Michal Hocko
SUSE Labs

--
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] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-18 11:29 ` Piotr Kwapulinski
@ 2016-09-20  0:57   ` David Rientjes
  -1 siblings, 0 replies; 54+ messages in thread
From: David Rientjes @ 2016-09-20  0:57 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel

On Sun, 18 Sep 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.
> 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.
> 
> Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>

Acked-by: David Rientjes <rientjes@google.com>

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?

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20  0:57   ` David Rientjes
  0 siblings, 0 replies; 54+ messages in thread
From: David Rientjes @ 2016-09-20  0:57 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel

On Sun, 18 Sep 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.
> 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.
> 
> Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>

Acked-by: David Rientjes <rientjes@google.com>

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 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] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20 15:12   ` Vlastimil Babka
  0 siblings, 0 replies; 54+ messages in thread
From: Vlastimil Babka @ 2016-09-20 15:12 UTC (permalink / raw)
  To: Piotr Kwapulinski, akpm
  Cc: kirill.shutemov, rientjes, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel, Linux API, linux-man,
	Peter Zijlstra

[CC += linux-api@vger.kernel.org]

     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 
linux-api@vger.kernel.org, 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...

On 09/18/2016 01:29 PM, 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.
> 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

> Isolated tests done.
>
> Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> ---
>  mm/mempolicy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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))
>

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20 15:12   ` Vlastimil Babka
  0 siblings, 0 replies; 54+ messages in thread
From: Vlastimil Babka @ 2016-09-20 15:12 UTC (permalink / raw)
  To: Piotr Kwapulinski, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
  Cc: kirill.shutemov-VuQAYsv1563Yd54FQh9/CA,
	rientjes-hpIqsD4AKlfQT0dZR+AlfA, mhocko-DgEjT+Ai2ygdnm+yROfE0A,
	mgorman-3eNAlZScCAx27rWaFMvyedHuzzzSOjJt,
	liangchen.linux-Re5JQEeQqe8AvxtiuMwx3w, nzimmer-sJ/iWh9BUns,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Linux API,
	linux-man-u79uwXL29TY76Z2rM5mHXA, Peter Zijlstra

[CC += linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org]

     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 
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, 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...

On 09/18/2016 01:29 PM, 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.
> 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

> Isolated tests done.
>
> Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  mm/mempolicy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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))
>

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20 15:12   ` Vlastimil Babka
  0 siblings, 0 replies; 54+ messages in thread
From: Vlastimil Babka @ 2016-09-20 15:12 UTC (permalink / raw)
  To: Piotr Kwapulinski, akpm
  Cc: kirill.shutemov, rientjes, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel, Linux API, linux-man,
	Peter Zijlstra

[CC += linux-api@vger.kernel.org]

     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 
linux-api@vger.kernel.org, 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...

On 09/18/2016 01:29 PM, 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.
> 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

> Isolated tests done.
>
> Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> ---
>  mm/mempolicy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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))
>

--
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] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-19 11:52   ` Michal Hocko
@ 2016-09-20 15:47     ` Piotr Kwapulinski
  -1 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-20 15:47 UTC (permalink / raw)
  To: Michal Hocko
  Cc: akpm, kirill.shutemov, vbabka, rientjes, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel

On Mon, Sep 19, 2016 at 01:52:05PM +0200, Michal Hocko wrote:
> On Sun 18-09-16 13:29:43, 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.
> > 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.

> > 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.

> > Isolated tests done.
> > 
> > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> > ---
> >  mm/mempolicy.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > 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.9.2
> 
> -- 
> Michal Hocko
> SUSE Labs

--
Piotr Kwapulinski

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20 15:47     ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-20 15:47 UTC (permalink / raw)
  To: Michal Hocko
  Cc: akpm, kirill.shutemov, vbabka, rientjes, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel

On Mon, Sep 19, 2016 at 01:52:05PM +0200, Michal Hocko wrote:
> On Sun 18-09-16 13:29:43, 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.
> > 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.

> > 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.

> > Isolated tests done.
> > 
> > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> > ---
> >  mm/mempolicy.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > 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.9.2
> 
> -- 
> Michal Hocko
> SUSE Labs

--
Piotr Kwapulinski

--
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] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-20  0:57   ` David Rientjes
@ 2016-09-20 15:56     ` Piotr Kwapulinski
  -1 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-20 15:56 UTC (permalink / raw)
  To: David Rientjes
  Cc: akpm, kirill.shutemov, vbabka, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel

On Mon, Sep 19, 2016 at 05:57:17PM -0700, David Rientjes wrote:
> On Sun, 18 Sep 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.
> > 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.
> > 
> > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> 
> Acked-by: David Rientjes <rientjes@google.com>
> 
> 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

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20 15:56     ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-20 15:56 UTC (permalink / raw)
  To: David Rientjes
  Cc: akpm, kirill.shutemov, vbabka, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel

On Mon, Sep 19, 2016 at 05:57:17PM -0700, David Rientjes wrote:
> On Sun, 18 Sep 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.
> > 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.
> > 
> > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> 
> Acked-by: David Rientjes <rientjes@google.com>
> 
> 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 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] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-20 15:12   ` Vlastimil Babka
@ 2016-09-20 16:23     ` Piotr Kwapulinski
  -1 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-20 16:23 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: akpm, kirill.shutemov, rientjes, mhocko, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel, Linux API,
	linux-man, Peter Zijlstra

On Tue, Sep 20, 2016 at 05:12:16PM +0200, Vlastimil Babka wrote:
> [CC += linux-api@vger.kernel.org]
> 
>     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
> linux-api@vger.kernel.org, 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...
> 
> On 09/18/2016 01:29 PM, 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.
> > 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()?
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().

> 
> Vlastimil
> 
> > Isolated tests done.
> > 
> > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> > ---
> >  mm/mempolicy.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > 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))
> > 
> 

--
Piotr Kwapulinski

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20 16:23     ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-20 16:23 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: akpm, kirill.shutemov, rientjes, mhocko, mgorman,
	liangchen.linux, nzimmer, linux-mm, linux-kernel, Linux API,
	linux-man, Peter Zijlstra

On Tue, Sep 20, 2016 at 05:12:16PM +0200, Vlastimil Babka wrote:
> [CC += linux-api@vger.kernel.org]
> 
>     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
> linux-api@vger.kernel.org, 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...
> 
> On 09/18/2016 01:29 PM, 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.
> > 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()?
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().

> 
> Vlastimil
> 
> > Isolated tests done.
> > 
> > Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
> > ---
> >  mm/mempolicy.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > 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))
> > 
> 

--
Piotr Kwapulinski

--
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] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-20 15:56     ` Piotr Kwapulinski
@ 2016-09-20 20:05       ` David Rientjes
  -1 siblings, 0 replies; 54+ messages in thread
From: David Rientjes @ 2016-09-20 20:05 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel

On Tue, 20 Sep 2016, Piotr Kwapulinski wrote:

> > 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.

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-20 20:05       ` David Rientjes
  0 siblings, 0 replies; 54+ messages in thread
From: David Rientjes @ 2016-09-20 20:05 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, mhocko, mgorman, liangchen.linux,
	nzimmer, linux-mm, linux-kernel

On Tue, 20 Sep 2016, Piotr Kwapulinski wrote:

> > 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 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] 54+ messages in thread

* [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
  2016-09-20 20:05       ` David Rientjes
@ 2016-09-27 13:19         ` Piotr Kwapulinski
  -1 siblings, 0 replies; 54+ 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

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-09-27 13:19         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* [PATCH 1/1] mm/mempolicy.c: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-09-27 13:22         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-27 13:22 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_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>
---
 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] 54+ messages in thread

* [PATCH 1/1] mm/mempolicy.c: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-09-27 13:22         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* [PATCH 1/1] mm/mempolicy.c: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-09-27 13:22         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-27 13:22 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_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>
---
 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

--
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] 54+ messages in thread

* [PATCH v2 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-20 20:05       ` David Rientjes
@ 2016-09-27 13:25         ` Piotr Kwapulinski
  -1 siblings, 0 replies; 54+ 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

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v2 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-09-27 13:25         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* [PATCH 1/1] man/set_mempolicy.2,mbind.2: forbid static or relative flags for local NUMA mode
@ 2016-09-27 13:27         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-27 13:27 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

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@gmail.com>
---
 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] 54+ messages in thread

* [PATCH 1/1] man/set_mempolicy.2,mbind.2: forbid static or relative flags for local NUMA mode
@ 2016-09-27 13:27         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* [PATCH 1/1] man/set_mempolicy.2,mbind.2: forbid static or relative flags for local NUMA mode
@ 2016-09-27 13:27         ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-09-27 13:27 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

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@gmail.com>
---
 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

--
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] 54+ messages in thread

* Re: [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-04  8:36           ` Christoph Lameter
  0 siblings, 0 replies; 54+ messages in thread
From: Christoph Lameter @ 2016-10-04  8:36 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

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] 54+ messages in thread

* Re: [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-04  8:36           ` Christoph Lameter
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* Re: [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-04  8:36           ` Christoph Lameter
  0 siblings, 0 replies; 54+ messages in thread
From: Christoph Lameter @ 2016-10-04  8:36 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

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.



--
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] 54+ messages in thread

* [PATCH v2 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-09 18:56             ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-10-09 18:56 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 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] 54+ messages in thread

* [PATCH v2 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-09 18:56             ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* [PATCH v2 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-09 18:56             ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ messages in thread
From: Piotr Kwapulinski @ 2016-10-09 18:56 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 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

--
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] 54+ 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             ` Piotr Kwapulinski
@ 2016-10-10 13:55               ` Christoph Lameter
  -1 siblings, 0 replies; 54+ 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] 54+ messages in thread

* Re: [PATCH v2 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-10 13:55               ` Christoph Lameter
  0 siblings, 0 replies; 54+ 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>

--
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] 54+ 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
  -1 siblings, 0 replies; 54+ 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] 54+ messages in thread

* [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-10 16:23                 ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ 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

--
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] 54+ 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                 ` Piotr Kwapulinski
@ 2016-10-12  7:55                   ` Michael Kerrisk (man-pages)
  -1 siblings, 0 replies; 54+ 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/

^ permalink raw reply	[flat|nested] 54+ 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)
  0 siblings, 0 replies; 54+ 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] 54+ 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
  -1 siblings, 0 replies; 54+ 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] 54+ 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
  0 siblings, 0 replies; 54+ 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.

--
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] 54+ 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)
  -1 siblings, 0 replies; 54+ 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, 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/

^ permalink raw reply	[flat|nested] 54+ 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:35                       ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 54+ 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, 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] 54+ 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 15:53                     ` Piotr Kwapulinski
  -1 siblings, 0 replies; 54+ 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] 54+ 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
  0 siblings, 0 replies; 54+ 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

--
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] 54+ 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
  -1 siblings, 0 replies; 54+ 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.

^ permalink raw reply	[flat|nested] 54+ 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
  0 siblings, 0 replies; 54+ 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] 54+ 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)
  -1 siblings, 0 replies; 54+ 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/

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation
@ 2016-10-13  6:48                         ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* [PATCH v3 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
  2016-09-27 13:25         ` Piotr Kwapulinski
@ 2016-10-27 16:30           ` Piotr Kwapulinski
  -1 siblings, 0 replies; 54+ 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

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH v3 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-10-27 16:30           ` Piotr Kwapulinski
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* Re: [PATCH v3 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-11-01  0:21             ` David Rientjes
  0 siblings, 0 replies; 54+ messages in thread
From: David Rientjes @ 2016-11-01  0:21 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, mhocko, liangchen.linux, mgorman,
	dave.hansen, nzimmer, linux-mm, linux-kernel, linux-api

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@gmail.com>

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v3 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-11-01  0:21             ` David Rientjes
  0 siblings, 0 replies; 54+ 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] 54+ messages in thread

* Re: [PATCH v3 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode
@ 2016-11-01  0:21             ` David Rientjes
  0 siblings, 0 replies; 54+ messages in thread
From: David Rientjes @ 2016-11-01  0:21 UTC (permalink / raw)
  To: Piotr Kwapulinski
  Cc: akpm, kirill.shutemov, vbabka, mhocko, liangchen.linux, mgorman,
	dave.hansen, nzimmer, linux-mm, linux-kernel, linux-api

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@gmail.com>

Acked-by: David Rientjes <rientjes@google.com>

--
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] 54+ messages in thread

end of thread, other threads:[~2016-11-01  0:21 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-18 11:29 [PATCH] mm/mempolicy.c: forbid static or relative flags for local NUMA mode Piotr Kwapulinski
2016-09-18 11:29 ` Piotr Kwapulinski
2016-09-19 11:52 ` Michal Hocko
2016-09-19 11:52   ` Michal Hocko
2016-09-20 15:47   ` Piotr Kwapulinski
2016-09-20 15:47     ` Piotr Kwapulinski
2016-09-20  0:57 ` David Rientjes
2016-09-20  0:57   ` David Rientjes
2016-09-20 15:56   ` Piotr Kwapulinski
2016-09-20 15:56     ` Piotr Kwapulinski
2016-09-20 20:05     ` David Rientjes
2016-09-20 20:05       ` David Rientjes
2016-09-27 13:19       ` [PATCH 0/1] man/set_mempolicy.2,mbind.2: add MPOL_LOCAL NUMA memory policy documentation Piotr Kwapulinski
2016-09-27 13:19         ` Piotr Kwapulinski
2016-10-04  8:36         ` Christoph Lameter
2016-10-04  8:36           ` Christoph Lameter
2016-10-04  8:36           ` Christoph Lameter
2016-10-09 18:56           ` [PATCH v2 " Piotr Kwapulinski
2016-10-09 18:56             ` Piotr Kwapulinski
2016-10-09 18:56             ` Piotr Kwapulinski
2016-10-10 13:55             ` Christoph Lameter
2016-10-10 13:55               ` Christoph Lameter
2016-10-10 16:23               ` [PATCH v3 " Piotr Kwapulinski
2016-10-10 16:23                 ` Piotr Kwapulinski
2016-10-12  7:55                 ` Michael Kerrisk (man-pages)
2016-10-12  7:55                   ` Michael Kerrisk (man-pages)
2016-10-12 14:08                   ` Christoph Lameter
2016-10-12 14:08                     ` Christoph Lameter
2016-10-12 14:35                     ` Michael Kerrisk (man-pages)
2016-10-12 14:35                       ` Michael Kerrisk (man-pages)
2016-10-12 15:53                   ` Piotr Kwapulinski
2016-10-12 15:53                     ` Piotr Kwapulinski
2016-10-12 19:55                     ` Christoph Lameter
2016-10-12 19:55                       ` Christoph Lameter
2016-10-13  6:48                       ` Michael Kerrisk (man-pages)
2016-10-13  6:48                         ` Michael Kerrisk (man-pages)
2016-09-27 13:22       ` [PATCH 1/1] mm/mempolicy.c: " Piotr Kwapulinski
2016-09-27 13:22         ` Piotr Kwapulinski
2016-09-27 13:22         ` Piotr Kwapulinski
2016-09-27 13:25       ` [PATCH v2 0/1] mm/mempolicy.c: forbid static or relative flags for local NUMA mode Piotr Kwapulinski
2016-09-27 13:25         ` Piotr Kwapulinski
2016-10-27 16:30         ` [PATCH v3 " Piotr Kwapulinski
2016-10-27 16:30           ` Piotr Kwapulinski
2016-11-01  0:21           ` David Rientjes
2016-11-01  0:21             ` David Rientjes
2016-11-01  0:21             ` David Rientjes
2016-09-27 13:27       ` [PATCH 1/1] man/set_mempolicy.2,mbind.2: " Piotr Kwapulinski
2016-09-27 13:27         ` Piotr Kwapulinski
2016-09-27 13:27         ` Piotr Kwapulinski
2016-09-20 15:12 ` [PATCH] mm/mempolicy.c: " Vlastimil Babka
2016-09-20 15:12   ` Vlastimil Babka
2016-09-20 15:12   ` Vlastimil Babka
2016-09-20 16:23   ` Piotr Kwapulinski
2016-09-20 16:23     ` Piotr Kwapulinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.