* [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids
@ 2012-05-29 8:29 Jan Stancek
2012-06-28 7:29 ` Jan Stancek
0 siblings, 1 reply; 10+ messages in thread
From: Jan Stancek @ 2012-05-29 8:29 UTC (permalink / raw)
To: ltp-list; +Cc: Jeffrey Burke
Changes in v2:
get_allowed_pages()
- removed tst_resm(TFAIL,..)
- added break
- for ret == -3, set errno to EINVAL
move_pages_support.c
- check return value from get_allowed_nodes_arr()
mbind, get_mempolicy, move_pages
- removed curly brackets in single statement ifs
This patch series is a combination of:
[PATCH v3] mbind01, get_mempolicy01: dont use hardcoded node 0
[PATCH 1/2] move_pages_support: use only allowed nodes
[PATCH 2/2] move_pages: dont use hardcoded node numbers
so that all testcases use same shared code, which resides in libnuma_helper.a.
This library defines get_allowed_nodes() and get_allowed_nodes_arr() functions
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 (4):
add libnuma_helper.a
mbind01: dont use hardcoded NUMA node ids
get_mempolicy01: dont use hardcoded NUMA node ids
move_pages: dont use hardcoded NUMA node ids
testcases/kernel/syscalls/get_mempolicy/Makefile | 7 +-
.../syscalls/get_mempolicy/get_mempolicy01.c | 8 +-
testcases/kernel/syscalls/mbind/Makefile | 3 +-
testcases/kernel/syscalls/mbind/mbind01.c | 9 +-
testcases/kernel/syscalls/move_pages/Makefile | 5 +-
.../kernel/syscalls/move_pages/move_pages02.c | 11 +-
.../kernel/syscalls/move_pages/move_pages03.c | 11 +-
.../kernel/syscalls/move_pages/move_pages04.c | 11 +-
.../kernel/syscalls/move_pages/move_pages05.c | 11 +-
.../kernel/syscalls/move_pages/move_pages06.c | 9 +-
.../kernel/syscalls/move_pages/move_pages07.c | 11 +-
.../kernel/syscalls/move_pages/move_pages08.c | 9 +-
.../kernel/syscalls/move_pages/move_pages09.c | 7 +-
.../kernel/syscalls/move_pages/move_pages10.c | 11 +-
.../kernel/syscalls/move_pages/move_pages11.c | 11 +-
.../syscalls/move_pages/move_pages_support.c | 44 +++++--
.../syscalls/move_pages/move_pages_support.h | 1 +
.../syscalls/{get_mempolicy => numa}/Makefile | 13 +--
.../{get_mempolicy/Makefile => numa/Makefile.inc} | 20 ++--
.../syscalls/{get_mempolicy => numa/lib}/Makefile | 15 +--
testcases/kernel/syscalls/numa/lib/numa_helper.c | 135 ++++++++++++++++++++
testcases/kernel/syscalls/numa/lib/numa_helper.h | 34 +++++
22 files changed, 304 insertions(+), 92 deletions(-)
copy testcases/kernel/syscalls/{get_mempolicy => numa}/Makefile (73%)
copy testcases/kernel/syscalls/{get_mempolicy/Makefile => numa/Makefile.inc} (69%)
copy testcases/kernel/syscalls/{get_mempolicy => numa/lib}/Makefile (71%)
create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids
2012-05-29 8:29 Jan Stancek
@ 2012-06-28 7:29 ` Jan Stancek
2012-06-28 7:36 ` Wanlong Gao
0 siblings, 1 reply; 10+ messages in thread
From: Jan Stancek @ 2012-06-28 7:29 UTC (permalink / raw)
To: ltp-list
Hi,
any thoughts on this version?
Regards,
Jan
On 05/29/2012 10:29 AM, Jan Stancek wrote:
> Changes in v2:
> get_allowed_pages()
> - removed tst_resm(TFAIL,..)
> - added break
> - for ret == -3, set errno to EINVAL
> move_pages_support.c
> - check return value from get_allowed_nodes_arr()
> mbind, get_mempolicy, move_pages
> - removed curly brackets in single statement ifs
>
> This patch series is a combination of:
> [PATCH v3] mbind01, get_mempolicy01: dont use hardcoded node 0
> [PATCH 1/2] move_pages_support: use only allowed nodes
> [PATCH 2/2] move_pages: dont use hardcoded node numbers
>
> so that all testcases use same shared code, which resides in libnuma_helper.a.
> This library defines get_allowed_nodes() and get_allowed_nodes_arr() functions
> 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 (4):
> add libnuma_helper.a
> mbind01: dont use hardcoded NUMA node ids
> get_mempolicy01: dont use hardcoded NUMA node ids
> move_pages: dont use hardcoded NUMA node ids
>
> testcases/kernel/syscalls/get_mempolicy/Makefile | 7 +-
> .../syscalls/get_mempolicy/get_mempolicy01.c | 8 +-
> testcases/kernel/syscalls/mbind/Makefile | 3 +-
> testcases/kernel/syscalls/mbind/mbind01.c | 9 +-
> testcases/kernel/syscalls/move_pages/Makefile | 5 +-
> .../kernel/syscalls/move_pages/move_pages02.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages03.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages04.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages05.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages06.c | 9 +-
> .../kernel/syscalls/move_pages/move_pages07.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages08.c | 9 +-
> .../kernel/syscalls/move_pages/move_pages09.c | 7 +-
> .../kernel/syscalls/move_pages/move_pages10.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages11.c | 11 +-
> .../syscalls/move_pages/move_pages_support.c | 44 +++++--
> .../syscalls/move_pages/move_pages_support.h | 1 +
> .../syscalls/{get_mempolicy => numa}/Makefile | 13 +--
> .../{get_mempolicy/Makefile => numa/Makefile.inc} | 20 ++--
> .../syscalls/{get_mempolicy => numa/lib}/Makefile | 15 +--
> testcases/kernel/syscalls/numa/lib/numa_helper.c | 135 ++++++++++++++++++++
> testcases/kernel/syscalls/numa/lib/numa_helper.h | 34 +++++
> 22 files changed, 304 insertions(+), 92 deletions(-)
> copy testcases/kernel/syscalls/{get_mempolicy => numa}/Makefile (73%)
> copy testcases/kernel/syscalls/{get_mempolicy/Makefile => numa/Makefile.inc} (69%)
> copy testcases/kernel/syscalls/{get_mempolicy => numa/lib}/Makefile (71%)
> create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
> create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
>
>
> ------------------------------------------------------------------------------
> 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
> Ltp-list@lists.sourceforge.net
> 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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids
2012-06-28 7:29 ` Jan Stancek
@ 2012-06-28 7:36 ` Wanlong Gao
2012-06-28 7:53 ` Jan Stancek
0 siblings, 1 reply; 10+ messages in thread
From: Wanlong Gao @ 2012-06-28 7:36 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On 06/28/2012 03:29 PM, Jan Stancek wrote:
> Hi,
>
> any thoughts on this version?
Hi Jan,
you sent many series of patches, but it's hard to find out that
which patch belongs to this series.
So, can you send patch set like this.
[0]-xxxxxxxxxxxxxxxxxxxxxxx
|_[1]xxxxxxxxxxxxxxxxxxxxxxxxx
|_[2]xxxxxxxxxxxxxxxxxxxxxxxx
I mean, one series in one thread ?
Thanks,
Wanlong Gao
>
> Regards,
> Jan
>
> On 05/29/2012 10:29 AM, Jan Stancek wrote:
>> Changes in v2:
>> get_allowed_pages()
>> - removed tst_resm(TFAIL,..)
>> - added break
>> - for ret == -3, set errno to EINVAL
>> move_pages_support.c
>> - check return value from get_allowed_nodes_arr()
>> mbind, get_mempolicy, move_pages
>> - removed curly brackets in single statement ifs
>>
>> This patch series is a combination of:
>> [PATCH v3] mbind01, get_mempolicy01: dont use hardcoded node 0
>> [PATCH 1/2] move_pages_support: use only allowed nodes
>> [PATCH 2/2] move_pages: dont use hardcoded node numbers
>>
>> so that all testcases use same shared code, which resides in libnuma_helper.a.
>> This library defines get_allowed_nodes() and get_allowed_nodes_arr() functions
>> 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 (4):
>> add libnuma_helper.a
>> mbind01: dont use hardcoded NUMA node ids
>> get_mempolicy01: dont use hardcoded NUMA node ids
>> move_pages: dont use hardcoded NUMA node ids
>>
>> testcases/kernel/syscalls/get_mempolicy/Makefile | 7 +-
>> .../syscalls/get_mempolicy/get_mempolicy01.c | 8 +-
>> testcases/kernel/syscalls/mbind/Makefile | 3 +-
>> testcases/kernel/syscalls/mbind/mbind01.c | 9 +-
>> testcases/kernel/syscalls/move_pages/Makefile | 5 +-
>> .../kernel/syscalls/move_pages/move_pages02.c | 11 +-
>> .../kernel/syscalls/move_pages/move_pages03.c | 11 +-
>> .../kernel/syscalls/move_pages/move_pages04.c | 11 +-
>> .../kernel/syscalls/move_pages/move_pages05.c | 11 +-
>> .../kernel/syscalls/move_pages/move_pages06.c | 9 +-
>> .../kernel/syscalls/move_pages/move_pages07.c | 11 +-
>> .../kernel/syscalls/move_pages/move_pages08.c | 9 +-
>> .../kernel/syscalls/move_pages/move_pages09.c | 7 +-
>> .../kernel/syscalls/move_pages/move_pages10.c | 11 +-
>> .../kernel/syscalls/move_pages/move_pages11.c | 11 +-
>> .../syscalls/move_pages/move_pages_support.c | 44 +++++--
>> .../syscalls/move_pages/move_pages_support.h | 1 +
>> .../syscalls/{get_mempolicy => numa}/Makefile | 13 +--
>> .../{get_mempolicy/Makefile => numa/Makefile.inc} | 20 ++--
>> .../syscalls/{get_mempolicy => numa/lib}/Makefile | 15 +--
>> testcases/kernel/syscalls/numa/lib/numa_helper.c | 135 ++++++++++++++++++++
>> testcases/kernel/syscalls/numa/lib/numa_helper.h | 34 +++++
>> 22 files changed, 304 insertions(+), 92 deletions(-)
>> copy testcases/kernel/syscalls/{get_mempolicy => numa}/Makefile (73%)
>> copy testcases/kernel/syscalls/{get_mempolicy/Makefile => numa/Makefile.inc} (69%)
>> copy testcases/kernel/syscalls/{get_mempolicy => numa/lib}/Makefile (71%)
>> create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
>> create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>> Ltp-list@lists.sourceforge.net
>> 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
> Ltp-list@lists.sourceforge.net
> 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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids
2012-06-28 7:36 ` Wanlong Gao
@ 2012-06-28 7:53 ` Jan Stancek
0 siblings, 0 replies; 10+ messages in thread
From: Jan Stancek @ 2012-06-28 7:53 UTC (permalink / raw)
To: gaowanlong; +Cc: ltp-list
----- Original Message -----
> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Thursday, 28 June, 2012 9:36:49 AM
> Subject: Re: [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids
>
> On 06/28/2012 03:29 PM, Jan Stancek wrote:
> > Hi,
> >
> > any thoughts on this version?
>
> Hi Jan,
>
> you sent many series of patches, but it's hard to find out that
> which patch belongs to this series.
My apologies, I kept merging them together as same pattern
was repeating in different syscall testcases.
>
> So, can you send patch set like this.
> [0]-xxxxxxxxxxxxxxxxxxxxxxx
> |_[1]xxxxxxxxxxxxxxxxxxxxxxxxx
> |_[2]xxxxxxxxxxxxxxxxxxxxxxxx
>
> I mean, one series in one thread ?
Sure, I'll resend (once I check that my client does the right thing).
Regards,
Jan
>
> Thanks,
> Wanlong Gao
>
> >
> > Regards,
> > Jan
> >
> > On 05/29/2012 10:29 AM, Jan Stancek wrote:
> >> Changes in v2:
> >> get_allowed_pages()
> >> - removed tst_resm(TFAIL,..)
> >> - added break
> >> - for ret == -3, set errno to EINVAL
> >> move_pages_support.c
> >> - check return value from get_allowed_nodes_arr()
> >> mbind, get_mempolicy, move_pages
> >> - removed curly brackets in single statement ifs
> >>
> >> This patch series is a combination of:
> >> [PATCH v3] mbind01, get_mempolicy01: dont use hardcoded node 0
> >> [PATCH 1/2] move_pages_support: use only allowed nodes
> >> [PATCH 2/2] move_pages: dont use hardcoded node numbers
> >>
> >> so that all testcases use same shared code, which resides in
> >> libnuma_helper.a.
> >> This library defines get_allowed_nodes() and
> >> get_allowed_nodes_arr() functions
> >> 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 (4):
> >> add libnuma_helper.a
> >> mbind01: dont use hardcoded NUMA node ids
> >> get_mempolicy01: dont use hardcoded NUMA node ids
> >> move_pages: dont use hardcoded NUMA node ids
> >>
> >> testcases/kernel/syscalls/get_mempolicy/Makefile | 7 +-
> >> .../syscalls/get_mempolicy/get_mempolicy01.c | 8 +-
> >> testcases/kernel/syscalls/mbind/Makefile | 3 +-
> >> testcases/kernel/syscalls/mbind/mbind01.c | 9 +-
> >> testcases/kernel/syscalls/move_pages/Makefile | 5 +-
> >> .../kernel/syscalls/move_pages/move_pages02.c | 11 +-
> >> .../kernel/syscalls/move_pages/move_pages03.c | 11 +-
> >> .../kernel/syscalls/move_pages/move_pages04.c | 11 +-
> >> .../kernel/syscalls/move_pages/move_pages05.c | 11 +-
> >> .../kernel/syscalls/move_pages/move_pages06.c | 9 +-
> >> .../kernel/syscalls/move_pages/move_pages07.c | 11 +-
> >> .../kernel/syscalls/move_pages/move_pages08.c | 9 +-
> >> .../kernel/syscalls/move_pages/move_pages09.c | 7 +-
> >> .../kernel/syscalls/move_pages/move_pages10.c | 11 +-
> >> .../kernel/syscalls/move_pages/move_pages11.c | 11 +-
> >> .../syscalls/move_pages/move_pages_support.c | 44 +++++--
> >> .../syscalls/move_pages/move_pages_support.h | 1 +
> >> .../syscalls/{get_mempolicy => numa}/Makefile | 13 +--
> >> .../{get_mempolicy/Makefile => numa/Makefile.inc} | 20 ++--
> >> .../syscalls/{get_mempolicy => numa/lib}/Makefile | 15 +--
> >> testcases/kernel/syscalls/numa/lib/numa_helper.c | 135
> >> ++++++++++++++++++++
> >> testcases/kernel/syscalls/numa/lib/numa_helper.h | 34 +++++
> >> 22 files changed, 304 insertions(+), 92 deletions(-)
> >> copy testcases/kernel/syscalls/{get_mempolicy => numa}/Makefile
> >> (73%)
> >> copy testcases/kernel/syscalls/{get_mempolicy/Makefile =>
> >> numa/Makefile.inc} (69%)
> >> copy testcases/kernel/syscalls/{get_mempolicy =>
> >> numa/lib}/Makefile (71%)
> >> create mode 100644
> >> testcases/kernel/syscalls/numa/lib/numa_helper.c
> >> create mode 100644
> >> testcases/kernel/syscalls/numa/lib/numa_helper.h
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> 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
> >> Ltp-list@lists.sourceforge.net
> >> 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
> > Ltp-list@lists.sourceforge.net
> > 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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids
@ 2012-06-28 9:03 Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 1/4] add libnuma_helper Jan Stancek
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Jan Stancek @ 2012-06-28 9:03 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1: Type: text/plain, Size: 4243 bytes --]
Changes in v2:
get_allowed_pages()
- removed tst_resm(TFAIL,..)
- added break
- for ret == -3, set errno to EINVAL
move_pages_support.c
- check return value from get_allowed_nodes_arr()
mbind, get_mempolicy, move_pages
- removed curly brackets in single statement ifs
This patch series is a combination of:
[PATCH v3] mbind01, get_mempolicy01: dont use hardcoded node 0
[PATCH 1/2] move_pages_support: use only allowed nodes
[PATCH 2/2] move_pages: dont use hardcoded node numbers
so that all testcases use same shared code, which resides in libnuma_helper.a.
This library defines get_allowed_nodes() and get_allowed_nodes_arr() functions
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 (4):
add libnuma_helper
mbind01: dont use hardcoded NUMA node ids
get_mempolicy01: dont use hardcoded NUMA node ids
move_pages: dont use hardcoded NUMA node ids
testcases/kernel/syscalls/get_mempolicy/Makefile | 7 +-
.../syscalls/get_mempolicy/get_mempolicy01.c | 8 +-
testcases/kernel/syscalls/mbind/Makefile | 3 +-
testcases/kernel/syscalls/mbind/mbind01.c | 9 +-
testcases/kernel/syscalls/move_pages/Makefile | 5 +-
.../kernel/syscalls/move_pages/move_pages02.c | 11 +-
.../kernel/syscalls/move_pages/move_pages03.c | 11 +-
.../kernel/syscalls/move_pages/move_pages04.c | 11 +-
.../kernel/syscalls/move_pages/move_pages05.c | 11 +-
.../kernel/syscalls/move_pages/move_pages06.c | 9 +-
.../kernel/syscalls/move_pages/move_pages07.c | 11 +-
.../kernel/syscalls/move_pages/move_pages08.c | 9 +-
.../kernel/syscalls/move_pages/move_pages09.c | 7 +-
.../kernel/syscalls/move_pages/move_pages10.c | 11 +-
.../kernel/syscalls/move_pages/move_pages11.c | 11 +-
.../syscalls/move_pages/move_pages_support.c | 44 +++++--
.../syscalls/move_pages/move_pages_support.h | 1 +
testcases/kernel/syscalls/numa/Makefile | 22 +++
testcases/kernel/syscalls/numa/Makefile.inc | 27 ++++
testcases/kernel/syscalls/numa/lib/Makefile | 26 ++++
testcases/kernel/syscalls/numa/lib/numa_helper.c | 135 ++++++++++++++++++++
testcases/kernel/syscalls/numa/lib/numa_helper.h | 34 +++++
22 files changed, 361 insertions(+), 62 deletions(-)
create mode 100644 testcases/kernel/syscalls/numa/Makefile
create mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
create mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
[-- Attachment #2: Type: text/plain, Size: 395 bytes --]
------------------------------------------------------------------------------
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/
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH v2 1/4] add libnuma_helper
2012-06-28 9:03 [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids Jan Stancek
@ 2012-06-28 9:03 ` Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 2/4] mbind01: dont use hardcoded NUMA node ids Jan Stancek
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Jan Stancek @ 2012-06-28 9:03 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1: Type: text/plain, Size: 836 bytes --]
A library to share NUMA helper functions shared by
multiple testcases.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/numa/Makefile | 22 ++++
testcases/kernel/syscalls/numa/Makefile.inc | 27 +++++
testcases/kernel/syscalls/numa/lib/Makefile | 26 ++++
testcases/kernel/syscalls/numa/lib/numa_helper.c | 135 ++++++++++++++++++++++
testcases/kernel/syscalls/numa/lib/numa_helper.h | 34 ++++++
5 files changed, 244 insertions(+), 0 deletions(-)
create mode 100644 testcases/kernel/syscalls/numa/Makefile
create mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
create mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-add-libnuma_helper.patch --]
[-- Type: text/x-patch; name="0001-add-libnuma_helper.patch", Size: 8929 bytes --]
diff --git a/testcases/kernel/syscalls/numa/Makefile b/testcases/kernel/syscalls/numa/Makefile
new file mode 100644
index 0000000..b38c5b2
--- /dev/null
+++ b/testcases/kernel/syscalls/numa/Makefile
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2012 Linux Test Project, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/syscalls/numa/Makefile.inc b/testcases/kernel/syscalls/numa/Makefile.inc
new file mode 100644
index 0000000..59c2f9e
--- /dev/null
+++ b/testcases/kernel/syscalls/numa/Makefile.inc
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2012 Linux Test Project, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+CPPFLAGS += $(NUMA_CPPFLAGS) -I../numa/lib/
+LIBDIR := ../numa/lib
+LIB := $(LIBDIR)/libnuma_helper.a
+MAKE_DEPS += $(LIB)
+LDLIBS += $(NUMA_LIBS) -lnuma_helper -lltp
+LDFLAGS += -L$(LIBDIR)
+
+$(LIB): $(LIBDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
diff --git a/testcases/kernel/syscalls/numa/lib/Makefile b/testcases/kernel/syscalls/numa/lib/Makefile
new file mode 100644
index 0000000..d4a6f41
--- /dev/null
+++ b/testcases/kernel/syscalls/numa/lib/Makefile
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2012 Linux Test Project, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+CPPFLAGS += -I../../../include
+LIB := libnuma_helper.a
+
+include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/kernel/syscalls/numa/lib/numa_helper.c b/testcases/kernel/syscalls/numa/lib/numa_helper.c
new file mode 100644
index 0000000..855ee2c
--- /dev/null
+++ b/testcases/kernel/syscalls/numa/lib/numa_helper.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2012 Linux Test Project, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include <errno.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+#if HAVE_NUMAIF_H
+#include <numaif.h>
+#endif
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "test.h"
+#include "usctest.h"
+#include "safe_macros.h"
+#include "numa_helper.h"
+#include "linux_syscall_numbers.h"
+
+/*
+ * get_allowed_nodes_arr - get number and array of available nodes
+ * @num_allowed_nodes: pointer where number of available nodes will be stored
+ * @allowed_nodes: array of available node ids, this is MPOL_F_MEMS_ALLOWED
+ * node bitmask compacted (without holes), so that each field
+ * contains node number. If NULL only num_allowed_nodes is
+ * returned, otherwise it cotains new allocated array,
+ * which caller is responsible to free.
+ * RETURNS:
+ * 0 on success
+ * -1 on allocation failure
+ * -2 on get_mempolicy failure
+ */
+int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes)
+{
+#if HAVE_NUMA_H
+ int i;
+ struct bitmask *allowed_nodemask = NULL;
+#endif
+ *num_allowed_nodes = 0;
+ if (allowed_nodes)
+ *allowed_nodes = NULL;
+
+#if HAVE_NUMA_H && HAVE_MPOL_CONSTANTS
+ if ((allowed_nodemask = numa_allocate_nodemask()) == NULL)
+ return -1;
+
+ if (allowed_nodes) {
+ *allowed_nodes = malloc(sizeof(int)*allowed_nodemask->size);
+ if (*allowed_nodes == NULL)
+ return -1;
+ }
+
+ /*
+ * avoid numa_get_mems_allowed(), because of bug in getpol()
+ * utility function in older versions:
+ * http://www.spinics.net/lists/linux-numa/msg00849.html
+ */
+ if (syscall(__NR_get_mempolicy, NULL, allowed_nodemask->maskp,
+ allowed_nodemask->size, 0, MPOL_F_MEMS_ALLOWED) < 0) {
+ numa_bitmask_free(allowed_nodemask);
+ if (allowed_nodes) {
+ free(*allowed_nodes);
+ *allowed_nodes = NULL;
+ }
+ return -2;
+ }
+
+ for (i = 0; i < allowed_nodemask->size; i++) {
+ if (numa_bitmask_isbitset(allowed_nodemask, i)) {
+ if (allowed_nodes)
+ (*allowed_nodes)[*num_allowed_nodes] = i;
+ (*num_allowed_nodes)++;
+ }
+ }
+ numa_bitmask_free(allowed_nodemask);
+#endif
+ return 0;
+}
+
+/*
+ * get_allowed_nodes - convenience function to get fixed number of nodes
+ * @count: how many nodes to get
+ * @...: int pointers, where node ids will be stored
+ * RETURNS:
+ * 0 on success
+ * -1 on allocation failure
+ * -2 on get_mempolicy failure
+ * -3 on not enough allowed nodes
+ */
+int get_allowed_nodes(int count, ...)
+{
+ int ret;
+ int i, *nodep;
+ va_list ap;
+ int num_nodes = 0;
+ int *nodes = NULL;
+
+ if ((ret = get_allowed_nodes_arr(&num_nodes, &nodes)) < 0)
+ return ret;
+
+ va_start(ap, count);
+ for (i = 0; i < count; i++) {
+ nodep = va_arg(ap, int *);
+ if (i < num_nodes) {
+ *nodep = nodes[i];
+ } else {
+ ret = -3;
+ errno = EINVAL;
+ break;
+ }
+ }
+ free(nodes);
+ va_end(ap);
+
+ return ret;
+}
diff --git a/testcases/kernel/syscalls/numa/lib/numa_helper.h b/testcases/kernel/syscalls/numa/lib/numa_helper.h
new file mode 100644
index 0000000..73b6513
--- /dev/null
+++ b/testcases/kernel/syscalls/numa/lib/numa_helper.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Linux Test Project, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef NUMA_HELPER_H
+#define NUMA_HELPER_H
+
+#include "config.h"
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+#if HAVE_NUMAIF_H
+#include <numaif.h>
+#endif
+
+int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes);
+int get_allowed_nodes(int count, ...);
+
+#endif
+
[-- Attachment #3: Type: text/plain, Size: 395 bytes --]
------------------------------------------------------------------------------
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/
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH v2 2/4] mbind01: dont use hardcoded NUMA node ids
2012-06-28 9:03 [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 1/4] add libnuma_helper Jan Stancek
@ 2012-06-28 9:03 ` Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 3/4] get_mempolicy01: " Jan Stancek
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Jan Stancek @ 2012-06-28 9:03 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/mbind/Makefile | 3 +--
testcases/kernel/syscalls/mbind/mbind01.c | 9 +++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-mbind01-dont-use-hardcoded-NUMA-node-ids.patch --]
[-- Type: text/x-patch; name="0002-mbind01-dont-use-hardcoded-NUMA-node-ids.patch", Size: 1589 bytes --]
diff --git a/testcases/kernel/syscalls/mbind/Makefile b/testcases/kernel/syscalls/mbind/Makefile
index bc50178..932037f 100644
--- a/testcases/kernel/syscalls/mbind/Makefile
+++ b/testcases/kernel/syscalls/mbind/Makefile
@@ -31,6 +31,5 @@ endif
CPPFLAGS += -I$(abs_srcdir)/../utils/
-LDLIBS += $(NUMA_LIBS)
-
+include $(abs_srcdir)/../numa/Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index 4b25db0..1148324 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -63,6 +63,7 @@
#include "usctest.h"
#include "linux_syscall_numbers.h"
#include "include_j_h.h"
+#include "numa_helper.h"
char *TCID = "mbind01";
int TST_TOTAL = 2;
@@ -217,15 +218,19 @@ static int do_test(struct test_case *tc)
unsigned long maxnode = NUMA_NUM_NODES;
unsigned long len = MEM_LENGTH;
unsigned long *invalid_nodemask;
+ int test_node = -1;
+
+ if ((ret = get_allowed_nodes(1, &test_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
nodemask = malloc(sizeof(nodemask_t));
nodemask_zero(nodemask);
- nodemask_set(nodemask, 0);
+ nodemask_set(nodemask, test_node);
getnodemask = malloc(sizeof(nodemask_t));
nodemask_zero(getnodemask);
#else
- numa_bitmask_setbit(nodemask, 0);
+ numa_bitmask_setbit(nodemask, test_node);
#endif
p = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
0, 0);
[-- Attachment #3: Type: text/plain, Size: 395 bytes --]
------------------------------------------------------------------------------
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/
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH v2 3/4] get_mempolicy01: dont use hardcoded NUMA node ids
2012-06-28 9:03 [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 1/4] add libnuma_helper Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 2/4] mbind01: dont use hardcoded NUMA node ids Jan Stancek
@ 2012-06-28 9:03 ` Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 4/4] move_pages: " Jan Stancek
2012-06-29 1:54 ` [LTP] [PATCH v2 0/4] " Wanlong Gao
4 siblings, 0 replies; 10+ messages in thread
From: Jan Stancek @ 2012-06-28 9:03 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1: Type: text/plain, Size: 240 bytes --]
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/get_mempolicy/Makefile | 7 ++-----
.../syscalls/get_mempolicy/get_mempolicy01.c | 8 ++++++--
2 files changed, 8 insertions(+), 7 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-get_mempolicy01-dont-use-hardcoded-NUMA-node-ids.patch --]
[-- Type: text/x-patch; name="0003-get_mempolicy01-dont-use-hardcoded-NUMA-node-ids.patch", Size: 1821 bytes --]
diff --git a/testcases/kernel/syscalls/get_mempolicy/Makefile b/testcases/kernel/syscalls/get_mempolicy/Makefile
index 2791e85..333ad21 100644
--- a/testcases/kernel/syscalls/get_mempolicy/Makefile
+++ b/testcases/kernel/syscalls/get_mempolicy/Makefile
@@ -20,10 +20,7 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-CPPFLAGS += -g
-
-CPPFLAGS += -I$(abs_srcdir)/../utils $(NUMA_CPPFLAGS)
-
-LDLIBS += $(NUMA_LIBS)
+CPPFLAGS += -I$(abs_srcdir)/../utils
+include $(abs_srcdir)/../numa/Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
index 0565d6f..9011980 100644
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
+++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
@@ -63,6 +63,7 @@
#include "linux_syscall_numbers.h"
#include "include_j_h.h"
#include "common_j_h.c"
+#include "numa_helper.h"
char *TCID = "get_mempolicy01"; /* Test program identifier.*/
int TST_TOTAL = 1; /* total number of tests in this file. */
@@ -231,15 +232,18 @@ static int do_test(struct test_case *tc)
#endif
char *p = NULL;
unsigned long len = MEM_LENGTH;
+ int test_node = -1;
+ if ((ret = get_allowed_nodes(1, &test_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
nodemask = malloc(sizeof(nodemask_t));
nodemask_zero(nodemask);
- nodemask_set(nodemask, 0);
+ nodemask_set(nodemask, test_node);
getnodemask = malloc(sizeof(nodemask_t));
nodemask_zero(getnodemask);
#else
- numa_bitmask_setbit(nodemask, 0);
+ numa_bitmask_setbit(nodemask, test_node);
#endif
switch (tc->ttype) {
case DEFAULT:
[-- Attachment #3: Type: text/plain, Size: 395 bytes --]
------------------------------------------------------------------------------
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/
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH v2 4/4] move_pages: dont use hardcoded NUMA node ids
2012-06-28 9:03 [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids Jan Stancek
` (2 preceding siblings ...)
2012-06-28 9:03 ` [LTP] [PATCH v2 3/4] get_mempolicy01: " Jan Stancek
@ 2012-06-28 9:03 ` Jan Stancek
2012-06-29 1:54 ` [LTP] [PATCH v2 0/4] " Wanlong Gao
4 siblings, 0 replies; 10+ messages in thread
From: Jan Stancek @ 2012-06-28 9:03 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1: Type: text/plain, Size: 957 bytes --]
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/move_pages/Makefile | 5 +-
.../kernel/syscalls/move_pages/move_pages02.c | 11 +++--
.../kernel/syscalls/move_pages/move_pages03.c | 11 +++--
.../kernel/syscalls/move_pages/move_pages04.c | 11 +++--
.../kernel/syscalls/move_pages/move_pages05.c | 11 +++--
.../kernel/syscalls/move_pages/move_pages06.c | 9 +++-
.../kernel/syscalls/move_pages/move_pages07.c | 11 +++--
.../kernel/syscalls/move_pages/move_pages08.c | 9 +++-
.../kernel/syscalls/move_pages/move_pages09.c | 7 ++-
.../kernel/syscalls/move_pages/move_pages10.c | 11 +++--
.../kernel/syscalls/move_pages/move_pages11.c | 11 +++--
.../syscalls/move_pages/move_pages_support.c | 44 ++++++++++++++-----
.../syscalls/move_pages/move_pages_support.h | 1 +
13 files changed, 101 insertions(+), 51 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-move_pages-dont-use-hardcoded-NUMA-node-ids.patch --]
[-- Type: text/x-patch; name="0004-move_pages-dont-use-hardcoded-NUMA-node-ids.patch", Size: 13497 bytes --]
diff --git a/testcases/kernel/syscalls/move_pages/Makefile b/testcases/kernel/syscalls/move_pages/Makefile
index d233378..cf2b83f 100644
--- a/testcases/kernel/syscalls/move_pages/Makefile
+++ b/testcases/kernel/syscalls/move_pages/Makefile
@@ -22,8 +22,6 @@ include $(top_srcdir)/include/mk/testcases.mk
CPPFLAGS += -I$(abs_srcdir)/../utils
-LDLIBS += $(NUMA_LIBS)
-
INSTALL_TARGETS := move_pages.sh
MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
@@ -35,6 +33,7 @@ move_pages_support.o: CFLAGS += -Wno-unused-function
$(MAKE_TARGETS): %: %.o move_pages_support.o
-LDLIBS += $(NUMA_LIBS) -lpthread -lrt
+LDLIBS += -lpthread -lrt
+include $(abs_srcdir)/../numa/Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/move_pages/move_pages02.c b/testcases/kernel/syscalls/move_pages/move_pages02.c
index cd0e914..410e368 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages02.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages02.c
@@ -83,15 +83,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
/* reset Tst_count in case we are looping */
Tst_count = 0;
@@ -156,4 +159,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages03.c b/testcases/kernel/syscalls/move_pages/move_pages03.c
index 791835b..77de94d 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages03.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages03.c
@@ -122,15 +122,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
pid_t cpid;
sem_t *sem;
@@ -223,4 +226,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages04.c b/testcases/kernel/syscalls/move_pages/move_pages04.c
index 4de116b..acb4c78 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages04.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages04.c
@@ -89,15 +89,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
unsigned long onepage = get_page_size();
/* reset Tst_count in case we are looping */
@@ -175,4 +178,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages05.c b/testcases/kernel/syscalls/move_pages/move_pages05.c
index 6b2334b..d2db475 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages05.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages05.c
@@ -123,15 +123,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[N_TEST_PAGES] = { 0 };
int nodes[N_TEST_PAGES];
int status[N_TEST_PAGES];
- int ret;
pid_t cpid;
sem_t *sem;
@@ -237,4 +240,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages06.c b/testcases/kernel/syscalls/move_pages/move_pages06.c
index 16e8206..6929f8d 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages06.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages06.c
@@ -83,15 +83,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
+ unsigned int from_node;
unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(1, &from_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
/* reset Tst_count in case we are looping */
Tst_count = 0;
@@ -152,4 +155,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages07.c b/testcases/kernel/syscalls/move_pages/move_pages07.c
index 2d2b1d8..4a1f96a 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages07.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages07.c
@@ -83,15 +83,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
int ipid;
/* reset Tst_count in case we are looping */
@@ -163,4 +166,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages08.c b/testcases/kernel/syscalls/move_pages/move_pages08.c
index 44c9acc..9b36a00 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages08.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages08.c
@@ -81,15 +81,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
/* reset Tst_count in case we are looping */
Tst_count = 0;
diff --git a/testcases/kernel/syscalls/move_pages/move_pages09.c b/testcases/kernel/syscalls/move_pages/move_pages09.c
index 3a626e8..8190a26 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages09.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages09.c
@@ -81,14 +81,17 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
+ unsigned int from_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(1, &from_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
/* reset Tst_count in case we are looping */
Tst_count = 0;
diff --git a/testcases/kernel/syscalls/move_pages/move_pages10.c b/testcases/kernel/syscalls/move_pages/move_pages10.c
index 7af861b..cec114c 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages10.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages10.c
@@ -83,15 +83,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
/* reset Tst_count in case we are looping */
Tst_count = 0;
@@ -151,4 +154,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages11.c b/testcases/kernel/syscalls/move_pages/move_pages11.c
index 747b9f0..3d82c6f 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages11.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages11.c
@@ -122,15 +122,18 @@ int main(int argc, char **argv)
#if HAVE_NUMA_MOVE_PAGES
unsigned int i;
int lc; /* loop counter */
- unsigned int from_node = 0;
- unsigned int to_node = 1;
+ unsigned int from_node;
+ unsigned int to_node;
+ int ret;
+
+ if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
+ tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
/* check for looping state if -i option is given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
void *pages[TEST_PAGES] = { 0 };
int nodes[TEST_PAGES];
int status[TEST_PAGES];
- int ret;
pid_t cpid;
sem_t *sem;
@@ -241,4 +244,4 @@ void cleanup(void)
*/
TEST_CLEANUP;
- }
\ No newline at end of file
+ }
diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
index 320486f..f7e3995 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
@@ -97,6 +97,7 @@ int alloc_pages_on_nodes(void **pages, unsigned int num, int *nodes)
return -1;
}
+
/*
* alloc_pages_linear() - allocate pages in each NUMA node
* @pages: array in which the page pointers will be stored
@@ -114,16 +115,22 @@ int alloc_pages_linear(void **pages, unsigned int num)
#if HAVE_NUMA_H
unsigned int i;
- unsigned int n;
+ unsigned int n = 0;
+ int num_allowed_nodes;
+ int *allowed_nodes;
+ int ret;
- n = 0;
- for (i = 0; i < num; i++) {
- nodes[i] = n;
+ ret = get_allowed_nodes_arr(&num_allowed_nodes, &allowed_nodes);
+ if (ret < 0)
+ tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret);
+ for (i = 0; i < num; i++) {
+ nodes[i] = allowed_nodes[n];
n++;
- if (n > numa_max_node())
+ if (n >= num_allowed_nodes)
n = 0;
}
+ free(allowed_nodes);
#endif
return alloc_pages_on_nodes(pages, num, nodes);
@@ -210,18 +217,23 @@ void verify_pages_linear(void **pages, int *status, unsigned int num)
{
#if HAVE_NUMA_H
unsigned int i;
- unsigned int n;
+ unsigned int n = 0;
int nodes[num];
+ int num_allowed_nodes;
+ int *allowed_nodes;
+ int ret;
- n = 0;
+ ret = get_allowed_nodes_arr(&num_allowed_nodes, &allowed_nodes);
+ if (ret < 0)
+ tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret);
for (i = 0; i < num; i++) {
- nodes[i] = i;
-
+ nodes[i] = allowed_nodes[n];
n++;
- if (n > numa_max_node())
+ if (n >= num_allowed_nodes)
n = 0;
}
+ free(allowed_nodes);
verify_pages_on_nodes(pages, status, num, nodes);
#endif
@@ -381,10 +393,18 @@ void free_sem(sem_t * sem, int num)
void check_config(unsigned int min_nodes)
{
#if HAVE_NUMA_H && HAVE_NUMAIF_H
+ int num_allowed_nodes;
+ int ret;
+
+ ret = get_allowed_nodes_arr(&num_allowed_nodes, NULL);
+ if (ret < 0)
+ tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret);
+
if (numa_available() < 0) {
tst_brkm(TCONF, NULL, "NUMA support is not available");
- } else if (numa_max_node() < (min_nodes - 1)) {
- tst_brkm(TCONF, NULL, "atleast 2 NUMA nodes are required");
+ } else if (num_allowed_nodes < min_nodes) {
+ tst_brkm(TCONF, NULL, "at least %d allowed NUMA nodes"
+ " are required", min_nodes);
} else if (tst_kvercmp(2, 6, 18) < 0) {
tst_brkm(TCONF, NULL, "2.6.18 or greater kernel required");
}
diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.h b/testcases/kernel/syscalls/move_pages/move_pages_support.h
index fd78572..bb8f636 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.h
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.h
@@ -27,6 +27,7 @@
#include <numaif.h>
#endif
#include <semaphore.h>
+#include "numa_helper.h"
long get_page_size();
[-- Attachment #3: Type: text/plain, Size: 395 bytes --]
------------------------------------------------------------------------------
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/
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids
2012-06-28 9:03 [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids Jan Stancek
` (3 preceding siblings ...)
2012-06-28 9:03 ` [LTP] [PATCH v2 4/4] move_pages: " Jan Stancek
@ 2012-06-29 1:54 ` Wanlong Gao
4 siblings, 0 replies; 10+ messages in thread
From: Wanlong Gao @ 2012-06-29 1:54 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On 06/28/2012 05:03 PM, Jan Stancek wrote:
>
> Changes in v2:
> get_allowed_pages()
> - removed tst_resm(TFAIL,..)
> - added break
> - for ret == -3, set errno to EINVAL
> move_pages_support.c
> - check return value from get_allowed_nodes_arr()
> mbind, get_mempolicy, move_pages
> - removed curly brackets in single statement ifs
pushed, thank you Jan.
Wanlong Gao
>
> This patch series is a combination of:
> [PATCH v3] mbind01, get_mempolicy01: dont use hardcoded node 0
> [PATCH 1/2] move_pages_support: use only allowed nodes
> [PATCH 2/2] move_pages: dont use hardcoded node numbers
>
> so that all testcases use same shared code, which resides in libnuma_helper.a.
> This library defines get_allowed_nodes() and get_allowed_nodes_arr() functions
> 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 (4):
> add libnuma_helper
> mbind01: dont use hardcoded NUMA node ids
> get_mempolicy01: dont use hardcoded NUMA node ids
> move_pages: dont use hardcoded NUMA node ids
>
> testcases/kernel/syscalls/get_mempolicy/Makefile | 7 +-
> .../syscalls/get_mempolicy/get_mempolicy01.c | 8 +-
> testcases/kernel/syscalls/mbind/Makefile | 3 +-
> testcases/kernel/syscalls/mbind/mbind01.c | 9 +-
> testcases/kernel/syscalls/move_pages/Makefile | 5 +-
> .../kernel/syscalls/move_pages/move_pages02.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages03.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages04.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages05.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages06.c | 9 +-
> .../kernel/syscalls/move_pages/move_pages07.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages08.c | 9 +-
> .../kernel/syscalls/move_pages/move_pages09.c | 7 +-
> .../kernel/syscalls/move_pages/move_pages10.c | 11 +-
> .../kernel/syscalls/move_pages/move_pages11.c | 11 +-
> .../syscalls/move_pages/move_pages_support.c | 44 +++++--
> .../syscalls/move_pages/move_pages_support.h | 1 +
> testcases/kernel/syscalls/numa/Makefile | 22 +++
> testcases/kernel/syscalls/numa/Makefile.inc | 27 ++++
> testcases/kernel/syscalls/numa/lib/Makefile | 26 ++++
> testcases/kernel/syscalls/numa/lib/numa_helper.c | 135 ++++++++++++++++++++
> testcases/kernel/syscalls/numa/lib/numa_helper.h | 34 +++++
> 22 files changed, 361 insertions(+), 62 deletions(-)
> create mode 100644 testcases/kernel/syscalls/numa/Makefile
> create mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
> create mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
> create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
> create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
>
>
>
> ------------------------------------------------------------------------------
> 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
> Ltp-list@lists.sourceforge.net
> 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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-06-29 1:54 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-28 9:03 [LTP] [PATCH v2 0/4] dont use hardcoded NUMA node ids Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 1/4] add libnuma_helper Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 2/4] mbind01: dont use hardcoded NUMA node ids Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 3/4] get_mempolicy01: " Jan Stancek
2012-06-28 9:03 ` [LTP] [PATCH v2 4/4] move_pages: " Jan Stancek
2012-06-29 1:54 ` [LTP] [PATCH v2 0/4] " Wanlong Gao
-- strict thread matches above, loose matches on Subject: below --
2012-05-29 8:29 Jan Stancek
2012-06-28 7:29 ` Jan Stancek
2012-06-28 7:36 ` Wanlong Gao
2012-06-28 7:53 ` Jan Stancek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox