Skip to contentSkip to conversation

mbind01, get_mempolicy01: dont use hardcoded node 0

PATCH Superseded Jan Stancek 3 participants 4 messages May 23, 2012 – May 24, 2012

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbind01, get_mempolicy01: dont use hardcoded node 0

These tests are failing on following setup:

  # 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: 9998 MB
  node distances:
  node   0   1
    0:  10  40
    1:  40  10

Avoid hardcoded node 0 by using numa_get_mems_allowed().

---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |    7 ++++---
 testcases/kernel/syscalls/mbind/mbind01.c          |    7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +4 -3
index 0565d6f..12dc8d3 100644
@@ -226,20 +226,21 @@ static int do_test(struct test_case *tc)
 	nodemask_t *nodemask, *getnodemask;
 	unsigned long maxnode = NUMA_NUM_NODES;
 #else
-	struct bitmask *nodemask = numa_allocate_nodemask();
+	struct bitmask *nodemask = NULL;
 	struct bitmask *getnodemask = numa_allocate_nodemask();
 #endif
 	char *p = NULL;
 	unsigned long len = MEM_LENGTH;
 
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
+	struct bitmask *allowed = numa_get_mems_allowed();
 	nodemask = malloc(sizeof(nodemask_t));
 	nodemask_zero(nodemask);
-	nodemask_set(nodemask, 0);
+	copy_bitmask_to_nodemask(allowed, nodemask);
 	getnodemask = malloc(sizeof(nodemask_t));
 	nodemask_zero(getnodemask);
 #else
-	numa_bitmask_setbit(nodemask, 0);
+	nodemask = numa_get_mems_allowed();
 #endif
 	switch (tc->ttype) {
 	case DEFAULT:
testcases/kernel/syscalls/mbind/mbind01.c +4 -3
index 4b25db0..48066db 100644
@@ -211,7 +211,7 @@ static int do_test(struct test_case *tc)
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
 	nodemask_t *nodemask, *getnodemask;
 #else
-	struct bitmask *nodemask = numa_allocate_nodemask();
+	struct bitmask *nodemask = NULL;
 	struct bitmask *getnodemask = numa_allocate_nodemask();
 #endif
 	unsigned long maxnode = NUMA_NUM_NODES;
@@ -219,13 +219,14 @@ static int do_test(struct test_case *tc)
 	unsigned long *invalid_nodemask;
 
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
+	struct bitmask *allowed = numa_get_mems_allowed();
 	nodemask = malloc(sizeof(nodemask_t));
 	nodemask_zero(nodemask);
-	nodemask_set(nodemask, 0);
+	copy_bitmask_to_nodemask(allowed, nodemask);
 	getnodemask = malloc(sizeof(nodemask_t));
 	nodemask_zero(getnodemask);
 #else
-	numa_bitmask_setbit(nodemask, 0);
+	nodemask = numa_get_mems_allowed();
 #endif
 	p = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
 		    0, 0);

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

Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Jan Stancek

These tests are failing on following setup:

  # 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: 9998 MB
  node distances:
  node   0   1
    0:  10  40
    1:  40  10
Quoted 3 lines

Avoid hardcoded node 0 by using numa_get_mems_allowed().

Quoted 18 lines
---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |    7 ++++---
 testcases/kernel/syscalls/mbind/mbind01.c          |    7 ++++---
 2 files changed, 8 insertions(+), 6 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/

Quoted 4 lines

_______________________________________________
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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Stancek
Quoted 16 lines · Jan Stancek

These tests are failing on following setup:

  # 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: 9998 MB
  node distances:
  node   0   1
    0:  10  40
    1:  40  10
Quoted 4 lines

Avoid hardcoded node 0 by using numa_get_mems_allowed().

---

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

#3 lore raw

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

Quoted 24 lines

From: "Caspar Zhang" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected], "Jeffrey Burke" <[email protected]>
Sent: Thursday, 24 May, 2012 2:22:28 PM
Subject: Re: [LTP] [PATCH] mbind01, get_mempolicy01: dont use hardcoded node 0

Quoted 17 lines · Jan Stancek

These tests are failing on following setup:

  # 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: 9998 MB
  node distances:
  node   0   1
    0:  10  40
    1:  40  10
Quoted 7 lines
Quoted 4 lines

Avoid hardcoded node 0 by using numa_get_mems_allowed().

---

Please hold off from comitting this patch,
I just found it breaks on larger NUMA systems in get_mempolicy.

Regards,
Jan

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