linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* is this a problem of numactl in RedHat7.0 ?
@ 2015-08-21  9:27 Xishi Qiu
  2015-08-21 20:53 ` Rik van Riel
  0 siblings, 1 reply; 4+ messages in thread
From: Xishi Qiu @ 2015-08-21  9:27 UTC (permalink / raw)
  To: LKML, Linux MM; +Cc: Xishi Qiu, Xiexiuqi

I use numactl(--localalloc) tool run a test case, but it shows that
the numa policy is prefer, I don't know why.

[root@localhost test]# numactl --hard
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 12 13 14 15 16 17
node 0 size: 32739 MB
node 0 free: 29134 MB
node 1 cpus: 6 7 8 9 10 11 18 19 20 21 22 23
node 1 size: 32768 MB
node 1 free: 31682 MB
node distances:
node   0   1
  0:  10  20
  1:  20  10

[root@localhost test]# numactl --localalloc --physcpubind=22 ./test.exe

[root@localhost linux-3.10-redhat]# ps -ef| grep test
root      18532  13994  1 05:24 pts/0    00:00:00 ./test.exe
root      18534  14037  0 05:24 pts/1    00:00:00 grep --color=auto test
[root@localhost linux-3.10-redhat]# cat /proc/18532/numa_maps
00400000 prefer:0 file=/home/qiuxishi/test/test.exe mapped=1 N0=1
00600000 prefer:0 file=/home/qiuxishi/test/test.exe anon=1 dirty=1 N1=1
00601000 prefer:0 file=/home/qiuxishi/test/test.exe anon=1 dirty=1 N1=1
7f1a15b9b000 prefer:0 file=/usr/lib64/libc-2.17.so mapped=51 mapmax=44 N0=49 N1=2
7f1a15d51000 prefer:0 file=/usr/lib64/libc-2.17.so
7f1a15f51000 prefer:0 file=/usr/lib64/libc-2.17.so anon=4 dirty=4 N1=4
7f1a15f55000 prefer:0 file=/usr/lib64/libc-2.17.so anon=2 dirty=2 N1=2
7f1a15f57000 prefer:0 anon=3 dirty=3 N1=3
7f1a15f5c000 prefer:0 file=/usr/lib64/ld-2.17.so mapped=28 mapmax=15 N0=23 N1=5
7f1a16166000 prefer:0 anon=3 dirty=3 N1=3
7f1a1617c000 prefer:0 anon=1 dirty=1 N1=1
7f1a1617d000 prefer:0 file=/usr/lib64/ld-2.17.so anon=1 dirty=1 N1=1
7f1a1617e000 prefer:0 file=/usr/lib64/ld-2.17.so anon=1 dirty=1 N1=1
7f1a1617f000 prefer:0 anon=1 dirty=1 N1=1
7ffd0d2ed000 prefer:0 stack anon=3 dirty=3 N1=3
7ffd0d3fc000 prefer: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	[flat|nested] 4+ messages in thread

* Re: is this a problem of numactl in RedHat7.0 ?
  2015-08-21  9:27 is this a problem of numactl in RedHat7.0 ? Xishi Qiu
@ 2015-08-21 20:53 ` Rik van Riel
  2015-08-24  3:28   ` Xishi Qiu
  2015-08-24  4:15   ` Xishi Qiu
  0 siblings, 2 replies; 4+ messages in thread
From: Rik van Riel @ 2015-08-21 20:53 UTC (permalink / raw)
  To: Xishi Qiu, LKML, Linux MM; +Cc: Xiexiuqi

On 08/21/2015 05:27 AM, Xishi Qiu wrote:
> I use numactl(--localalloc) tool run a test case, but it shows that
> the numa policy is prefer, I don't know why.

The kernel implements MPOL_PREFERRED and MPOL_LOCAL
in the same way. Look at this code in mpol_new(),
in mm/mempolicy.c:

         /*
          * MPOL_PREFERRED cannot be used with MPOL_F_STATIC_NODES or
          * MPOL_F_RELATIVE_NODES if the nodemask is empty (local 
allocation).
          * All other modes require a valid pointer to a non-empty nodemask.
          */
         if (mode == MPOL_PREFERRED) {
                 if (nodes_empty(*nodes)) {
                         if (((flags & MPOL_F_STATIC_NODES) ||
                              (flags & MPOL_F_RELATIVE_NODES)))
                                 return ERR_PTR(-EINVAL);
                 }
         } else if (mode == MPOL_LOCAL) {
                 if (!nodes_empty(*nodes))
                         return ERR_PTR(-EINVAL);
                 mode = MPOL_PREFERRED;
         } else if (nodes_empty(*nodes))
                 return ERR_PTR(-EINVAL);


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

* Re: is this a problem of numactl in RedHat7.0 ?
  2015-08-21 20:53 ` Rik van Riel
@ 2015-08-24  3:28   ` Xishi Qiu
  2015-08-24  4:15   ` Xishi Qiu
  1 sibling, 0 replies; 4+ messages in thread
From: Xishi Qiu @ 2015-08-24  3:28 UTC (permalink / raw)
  To: Rik van Riel; +Cc: LKML, Linux MM, Xiexiuqi

On 2015/8/22 4:53, Rik van Riel wrote:

> On 08/21/2015 05:27 AM, Xishi Qiu wrote:
>> I use numactl(--localalloc) tool run a test case, but it shows that
>> the numa policy is prefer, I don't know why.
> 
> The kernel implements MPOL_PREFERRED and MPOL_LOCAL
> in the same way. Look at this code in mpol_new(),
> in mm/mempolicy.c:
> 
>         /*
>          * MPOL_PREFERRED cannot be used with MPOL_F_STATIC_NODES or
>          * MPOL_F_RELATIVE_NODES if the nodemask is empty (local allocation).
>          * All other modes require a valid pointer to a non-empty nodemask.
>          */
>         if (mode == MPOL_PREFERRED) {
>                 if (nodes_empty(*nodes)) {
>                         if (((flags & MPOL_F_STATIC_NODES) ||
>                              (flags & MPOL_F_RELATIVE_NODES)))
>                                 return ERR_PTR(-EINVAL);
>                 }
>         } else if (mode == MPOL_LOCAL) {
>                 if (!nodes_empty(*nodes))
>                         return ERR_PTR(-EINVAL);
>                 mode = MPOL_PREFERRED;
>         } else if (nodes_empty(*nodes))
>                 return ERR_PTR(-EINVAL);
> 

Hi Rik,

Thank you for your reply. I find the reason is this patch,
and it is not backport to RedHat 7.0

8790c71a18e5d2d93532ae250bcf5eddbba729cd

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 873de7e..ae3c8f3 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2930,7 +2930,7 @@ void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
        unsigned short mode = MPOL_DEFAULT;
        unsigned short flags = 0;

-       if (pol && pol != &default_policy) {
+       if (pol && pol != &default_policy && !(pol->flags & MPOL_F_MORON)) {
                mode = pol->mode;
                flags = pol->flags;
        }

Thanks,
Xishi Qiu

> 
> 
> 



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

* Re: is this a problem of numactl in RedHat7.0 ?
  2015-08-21 20:53 ` Rik van Riel
  2015-08-24  3:28   ` Xishi Qiu
@ 2015-08-24  4:15   ` Xishi Qiu
  1 sibling, 0 replies; 4+ messages in thread
From: Xishi Qiu @ 2015-08-24  4:15 UTC (permalink / raw)
  To: Rik van Riel; +Cc: LKML, Linux MM, Xiexiuqi

On 2015/8/22 4:53, Rik van Riel wrote:

> On 08/21/2015 05:27 AM, Xishi Qiu wrote:
>> I use numactl(--localalloc) tool run a test case, but it shows that
>> the numa policy is prefer, I don't know why.
> 
> The kernel implements MPOL_PREFERRED and MPOL_LOCAL
> in the same way. Look at this code in mpol_new(),
> in mm/mempolicy.c:
> 

user:
"numactl --localalloc" wil call
	main()
	  numa_set_localalloc()
	    setpol(MPOL_DEFAULT, numa_no_nodes_ptr);
	      set_mempolicy()
	        syscall(__NR_set_mempolicy,mode,nmask,maxnode);

kernel:
	do_set_mempolicy()
	  mpol_new()
		if (mode == MPOL_DEFAULT) {
			if (nodes && !nodes_empty(*nodes))
				return ERR_PTR(-EINVAL);
			return NULL;  // return from here
		}

>         /*
>          * MPOL_PREFERRED cannot be used with MPOL_F_STATIC_NODES or
>          * MPOL_F_RELATIVE_NODES if the nodemask is empty (local allocation).
>          * All other modes require a valid pointer to a non-empty nodemask.
>          */
>         if (mode == MPOL_PREFERRED) {
>                 if (nodes_empty(*nodes)) {
>                         if (((flags & MPOL_F_STATIC_NODES) ||
>                              (flags & MPOL_F_RELATIVE_NODES)))
>                                 return ERR_PTR(-EINVAL);
>                 }
>         } else if (mode == MPOL_LOCAL) {
>                 if (!nodes_empty(*nodes))
>                         return ERR_PTR(-EINVAL);
>                 mode = MPOL_PREFERRED;
>         } else if (nodes_empty(*nodes))
>                 return ERR_PTR(-EINVAL);
> 
> 
> 
> 



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

end of thread, other threads:[~2015-08-24  4:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-21  9:27 is this a problem of numactl in RedHat7.0 ? Xishi Qiu
2015-08-21 20:53 ` Rik van Riel
2015-08-24  3:28   ` Xishi Qiu
2015-08-24  4:15   ` Xishi Qiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).