Skip to contentSkip to conversation

move_pages: dont use hardcoded node numbers

PATCH In review Jan Stancek 3 participants 4 messages May 25, 2012 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover move_pages: dont use hardcoded node numbers

Similar to previous patch for mbind01 and get_mempolicy01, move_pages tests are also using hardcoded nodes 0/1.

This patch series is introducing get_allowed_nodes() function to move_pages_support, which is using

    get_mempolicy(..., MPOL_F_MEMS_ALLOWED)

to obtain list of nodes tests can use.

I tested it with following setups. Note that setup 4 and 5 will end with TCONF as there is only 1 node with memory.

1.

# numactl -H
available: 8 nodes (2,4-10)
node 2 cpus: 0
node 2 size: 127 MB
node 2 free: 9 MB
node 4 cpus:
node 4 size: 128 MB
node 4 free: 9 MB
node 5 cpus:
node 5 size: 128 MB
node 5 free: 64 MB
node 6 cpus:
node 6 size: 128 MB
node 6 free: 121 MB
node 7 cpus:
node 7 size: 128 MB
node 7 free: 121 MB
node 8 cpus:
node 8 size: 128 MB
node 8 free: 121 MB
node 9 cpus:
node 9 size: 128 MB
node 9 free: 121 MB
node 10 cpus:
node 10 size: 127 MB
node 10 free: 123 MB

2.

# numactl -H
available: 4 nodes (0-3)
node 0 cpus: 0 1 2 3 4 5
node 0 size: 2047 MB
node 0 free: 564 MB
node 1 cpus: 6 7 8 9 10 11
node 1 size: 2046 MB
node 1 free: 451 MB
node 2 cpus: 18 19 20 21 22 23
node 2 size: 2048 MB
node 2 free: 595 MB
node 3 cpus: 12 13 14 15 16 17
node 3 size: 2048 MB
node 3 free: 236 MB
node distances:
node   0   1   2   3 
  0:  10  16  16  16 
  1:  16  10  16  16 
  2:  16  16  10  16 
  3:  16  16  16  10

3.

# numactl -H
available: 2 nodes (2-3)
node 2 cpus: 0
node 2 size: 511 MB
node 2 free: 154 MB
node 3 cpus:
node 3 size: 511 MB
node 3 free: 490 MB

4.

# numactl -H
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
node 0 size: 0 MB
node 0 free: 0 MB
node 1 cpus:
node 1 size: 12288 MB
node 1 free: 9689 MB
node distances:
node   0   1 
  0:  10  40 
  1:  40  10 

5.

# numactl -H
available: 1 nodes (0)
node 0 cpus: 0
node 0 size: 1023 MB
node 0 free: 654 MB
node distances:
node   0 
  0:  10 

Jan Stancek (2):
move_pages_support: use only allowed nodes
move_pages: dont use hardcoded node numbers

 .../kernel/syscalls/move_pages/move_pages02.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages03.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages04.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages05.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages06.c      |   10 ++-
 .../kernel/syscalls/move_pages/move_pages07.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages08.c      |   12 +++-
 .../kernel/syscalls/move_pages/move_pages09.c      |    8 ++-
 .../kernel/syscalls/move_pages/move_pages10.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages11.c      |   13 +++-
 .../syscalls/move_pages/move_pages_support.c       |   74 ++++++++++++++++----
 .../syscalls/move_pages/move_pages_support.h       |    1 +
 12 files changed, 157 insertions(+), 39 deletions(-)

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 101 lines · Jan Stancek

Similar to previous patch for mbind01 and get_mempolicy01, move_pages tests are also using hardcoded nodes 0/1.

This patch series is introducing get_allowed_nodes() function to move_pages_support, which is using

    get_mempolicy(..., MPOL_F_MEMS_ALLOWED)

to obtain list of nodes tests can use.

I tested it with following setups. Note that setup 4 and 5 will end with TCONF as there is only 1 node with memory.

1.

# numactl -H
available: 8 nodes (2,4-10)
node 2 cpus: 0
node 2 size: 127 MB
node 2 free: 9 MB
node 4 cpus:
node 4 size: 128 MB
node 4 free: 9 MB
node 5 cpus:
node 5 size: 128 MB
node 5 free: 64 MB
node 6 cpus:
node 6 size: 128 MB
node 6 free: 121 MB
node 7 cpus:
node 7 size: 128 MB
node 7 free: 121 MB
node 8 cpus:
node 8 size: 128 MB
node 8 free: 121 MB
node 9 cpus:
node 9 size: 128 MB
node 9 free: 121 MB
node 10 cpus:
node 10 size: 127 MB
node 10 free: 123 MB

2.

# numactl -H
available: 4 nodes (0-3)
node 0 cpus: 0 1 2 3 4 5
node 0 size: 2047 MB
node 0 free: 564 MB
node 1 cpus: 6 7 8 9 10 11
node 1 size: 2046 MB
node 1 free: 451 MB
node 2 cpus: 18 19 20 21 22 23
node 2 size: 2048 MB
node 2 free: 595 MB
node 3 cpus: 12 13 14 15 16 17
node 3 size: 2048 MB
node 3 free: 236 MB
node distances:
node   0   1   2   3 
  0:  10  16  16  16 
  1:  16  10  16  16 
  2:  16  16  10  16 
  3:  16  16  16  10

3.

# numactl -H
available: 2 nodes (2-3)
node 2 cpus: 0
node 2 size: 511 MB
node 2 free: 154 MB
node 3 cpus:
node 3 size: 511 MB
node 3 free: 490 MB

4.

# numactl -H
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
node 0 size: 0 MB
node 0 free: 0 MB
node 1 cpus:
node 1 size: 12288 MB
node 1 free: 9689 MB
node distances:
node   0   1 
  0:  10  40 
  1:  40  10 

5.

# numactl -H
available: 1 nodes (0)
node 0 cpus: 0
node 0 size: 1023 MB
node 0 free: 654 MB
node distances:
node   0 
  0:  10 

Jan Stancek (2):
move_pages_support: use only allowed nodes
move_pages: dont use hardcoded node numbers

Quoted 14 lines
 .../kernel/syscalls/move_pages/move_pages02.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages03.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages04.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages05.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages06.c      |   10 ++-
 .../kernel/syscalls/move_pages/move_pages07.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages08.c      |   12 +++-
 .../kernel/syscalls/move_pages/move_pages09.c      |    8 ++-
 .../kernel/syscalls/move_pages/move_pages10.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages11.c      |   13 +++-
 .../syscalls/move_pages/move_pages_support.c       |   74 ++++++++++++++++----
 .../syscalls/move_pages/move_pages_support.h       |    1 +
 12 files changed, 157 insertions(+), 39 deletions(-)

Looks like many duplications here... wondering if any chance putting them into a common function or something?

Thanks,
Caspar

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

----- Original Message -----

Quoted 25 lines

From: "Caspar Zhang" <[email protected]>
To: [email protected]
Sent: Friday, 25 May, 2012 11:16:09 AM
Subject: Re: [LTP] [PATCH 0/2] move_pages: dont use hardcoded node numbers

Quoted 4 lines

Jan Stancek (2):
move_pages_support: use only allowed nodes
move_pages: dont use hardcoded node numbers

Quoted 15 lines
 .../kernel/syscalls/move_pages/move_pages02.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages03.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages04.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages05.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages06.c      |   10 ++-
 .../kernel/syscalls/move_pages/move_pages07.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages08.c      |   12 +++-
 .../kernel/syscalls/move_pages/move_pages09.c      |    8 ++-
 .../kernel/syscalls/move_pages/move_pages10.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages11.c      |   13 +++-
 .../syscalls/move_pages/move_pages_support.c       |   74
 ++++++++++++++++----
 .../syscalls/move_pages/move_pages_support.h       |    1 +
 12 files changed, 157 insertions(+), 39 deletions(-)
Quoted 3 lines

Looks like many duplications here... wondering if any chance putting them into a common function or something?

That is probably good idea, because we may still find new places where can use it. I'm thinking about something like numa_helper.a, which we could link with mbind01, get_mempolicy01, move_pages, etc.

Or can you think of any better place where to put it?

Regards,
Jan

Quoted 16 lines

Thanks,
Caspar

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi!

Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 18 lines

move_pages_support: use only allowed nodes
move_pages: dont use hardcoded node numbers

 .../kernel/syscalls/move_pages/move_pages02.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages03.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages04.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages05.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages06.c      |   10 ++-
 .../kernel/syscalls/move_pages/move_pages07.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages08.c      |   12 +++-
 .../kernel/syscalls/move_pages/move_pages09.c      |    8 ++-
 .../kernel/syscalls/move_pages/move_pages10.c      |   13 +++-
 .../kernel/syscalls/move_pages/move_pages11.c      |   13 +++-
 .../syscalls/move_pages/move_pages_support.c       |   74
 ++++++++++++++++----
 .../syscalls/move_pages/move_pages_support.h       |    1 +
 12 files changed, 157 insertions(+), 39 deletions(-)

Looks like many duplications here... wondering if any chance putting them into a common function or something?

Quoted 6 lines
Quoted 2 lines

That is probably good idea, because we may still find new places where can use it. I'm thinking about something like numa_helper.a, which we could link with

I have no objection doing that.

Cyril, suggestions?

Yes, that is always a good idea. The easiest thing to do is to create a common.c file and include it in each of the tests (which I would do if the amount of shared code is relatively small and is used only by the tests in current directory). Otherwise you may do the usual library thing with actual headers and link tests against it...

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list