From 2079c3d4deba702b64d4279075995fb768619ba1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 05 2019 22:01:52 +0000 Subject: import numactl-2.0.12-7.el8 --- diff --git a/SOURCES/0001-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch b/SOURCES/0001-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch deleted file mode 100644 index 90d17ce..0000000 --- a/SOURCES/0001-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a8f5ed65b745f96f5e5af72bace8e7c63b96fd4e Mon Sep 17 00:00:00 2001 -From: Sanskriti Sharma -Date: Thu, 13 Sep 2018 10:01:58 -0400 -Subject: [PATCH] Fix: Add ShmemHugePages and ShmemPmdMapped to - system_meminfo[] - -ShmemHugePages and ShmemPmdMapped were recently added to -/sys/devices/system/node/node*/meminfo. Adding entries for them in the -system_meminfo data structure got rid of the error "Token Node not in hash -table." - -Signed-off-by: Sanskriti Sharma -Signed-off-by: Pingfan Liu ---- - numastat.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/numastat.c b/numastat.c -index 92d8496..25874db 100644 ---- a/numastat.c -+++ b/numastat.c -@@ -122,9 +122,11 @@ meminfo_t system_meminfo[] = { - { 27, "SReclaimable", "SReclaimable" }, - { 28, "SUnreclaim", "SUnreclaim" }, - { 29, "AnonHugePages", "AnonHugePages" }, -- { 30, "HugePages_Total", "HugePages_Total" }, -- { 31, "HugePages_Free", "HugePages_Free" }, -- { 32, "HugePages_Surp", "HugePages_Surp" } -+ { 30, "ShmemHugePages", "ShmemHugePages" }, -+ { 31, "ShmemPmdMapped", "ShmemPmdMapped" }, -+ { 32, "HugePages_Total", "HugePages_Total" }, -+ { 33, "HugePages_Free", "HugePages_Free" }, -+ { 34, "HugePages_Surp", "HugePages_Surp" } - }; - - #define SYSTEM_MEMINFO_ROWS (sizeof(system_meminfo) / sizeof(system_meminfo[0])) --- -2.7.4 - diff --git a/SOURCES/0001-Fix-node_list-with-memory-less-nodes.patch b/SOURCES/0001-Fix-node_list-with-memory-less-nodes.patch new file mode 100644 index 0000000..700642e --- /dev/null +++ b/SOURCES/0001-Fix-node_list-with-memory-less-nodes.patch @@ -0,0 +1,32 @@ +From cd7c78e77dc43fff5dbe2763f1ac83a8b4a6b1c7 Mon Sep 17 00:00:00 2001 +From: Harish +Date: Thu, 21 Jun 2018 07:53:10 +0530 +Subject: [PATCH 1/7] Fix: node_list with memory-less nodes + +Patch adds check to avoid memory-less nodes while traversing till +max node, and this also prevents nodes_to_use sysmalloc failure as +nodes_to_use is malloc'ed with numa_num_configured_nodes which +returns the number of nodes configured with memory. + +Signed-off-by: Harish +Signed-off-by: Pingfan Liu +--- + numademo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/numademo.c b/numademo.c +index b01e995..90d8e84 100644 +--- a/numademo.c ++++ b/numademo.c +@@ -307,7 +307,7 @@ void get_node_list() + node_to_use = (int *)malloc(numnodes * sizeof(int)); + max_node = numa_max_node(); + for (a = 0; a <= max_node; a++) { +- if(numa_node_size(a, &free_node_sizes) != -1) ++ if (numa_node_size(a, &free_node_sizes) > 0) + node_to_use[got_nodes++] = a; + } + } +-- +2.7.4 + diff --git a/SOURCES/0002-numademo-fix-wrong-node-input.patch b/SOURCES/0002-numademo-fix-wrong-node-input.patch new file mode 100644 index 0000000..8d41d7b --- /dev/null +++ b/SOURCES/0002-numademo-fix-wrong-node-input.patch @@ -0,0 +1,63 @@ +From 2b190afdbbff875e519e4ae45390bdde11e8e190 Mon Sep 17 00:00:00 2001 +From: Harish +Date: Wed, 20 Jun 2018 18:46:55 +0530 +Subject: [PATCH 2/7] numademo: fix wrong node input + +In few sparse node systems, test fails with invalid argument at +set_mempolicy through numa_preferred_node. Patch fixes it by +providing a valid wrong node. + +Signed-off-by: Harish +Signed-off-by: Pingfan Liu +--- + numademo.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/numademo.c b/numademo.c +index 90d8e84..4d3c058 100644 +--- a/numademo.c ++++ b/numademo.c +@@ -298,7 +298,7 @@ int popcnt(unsigned long val) + + int max_node, numnodes; + +-void get_node_list() ++int get_node_list() + { + int a, got_nodes = 0; + long free_node_sizes; +@@ -310,6 +310,9 @@ void get_node_list() + if (numa_node_size(a, &free_node_sizes) > 0) + node_to_use[got_nodes++] = a; + } ++ if(got_nodes != numnodes) ++ return -1; ++ return 0; + } + + void test(enum test type) +@@ -436,7 +439,7 @@ void test(enum test type) + numa_set_localalloc(); + memtest("local allocation", numa_alloc(msize)); + +- numa_set_preferred((node_to_use[i]+1) % numnodes ); ++ numa_set_preferred(node_to_use[(i + 1) % numnodes]); + memtest("setting wrong preferred node", numa_alloc(msize)); + numa_set_preferred(node_to_use[i]); + memtest("setting correct preferred node", numa_alloc(msize)); +@@ -512,7 +515,11 @@ int main(int ac, char **av) + if (!force) + exit(1); + } +- get_node_list(); ++ if(get_node_list()){ ++ fprintf(stderr, "Configured Nodes does not match available memory nodes\n"); ++ exit(1); ++ } ++ + printf("%d nodes available\n", numnodes); + fract_nodes = (((numnodes-1)/8)*2) + FRACT_NODES; + +-- +2.7.4 + diff --git a/SOURCES/0003-Fix-distance-test-to-include-all-existing-nodes.patch b/SOURCES/0003-Fix-distance-test-to-include-all-existing-nodes.patch new file mode 100644 index 0000000..f8da285 --- /dev/null +++ b/SOURCES/0003-Fix-distance-test-to-include-all-existing-nodes.patch @@ -0,0 +1,50 @@ +From c465ca7ca41aa03e755ed71fa0281c620b0d8dc0 Mon Sep 17 00:00:00 2001 +From: Harish +Date: Thu, 21 Jun 2018 17:22:36 +0530 +Subject: [PATCH 3/7] Fix: distance test to include all existing nodes + +The previous implementation did not consider memory-less nodes as +numa_num_configured_nodes() returns only nodes with memory and +numa_node_size() check is unnecessary for distance check. Hence +removed the check for memory. + +Signed-off-by: Harish +Signed-off-by: Pingfan Liu +--- + test/distance.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/test/distance.c b/test/distance.c +index fca109f..3471db6 100644 +--- a/test/distance.c ++++ b/test/distance.c +@@ -5,21 +5,20 @@ + + int main(void) + { +- int numnodes, maxnode, a, b, got_nodes = 0; ++ int maxnode, a, b, got_nodes = 0; + int *node_to_use; +- long size, free_node_sizes; + if (numa_available() < 0) { + printf("no numa support in kernel\n"); + exit(1); + } +- numnodes = numa_num_configured_nodes(); + maxnode = numa_max_node(); +- node_to_use = (int *)malloc(numnodes * sizeof(int)); ++ node_to_use = (int *)malloc(maxnode * sizeof(int)); + for (a = 0; a <= maxnode; a++) { +- size = numa_node_size(a, &free_node_sizes); +- if(size != -1) ++ if (numa_bitmask_isbitset(numa_nodes_ptr, a)){ + node_to_use[got_nodes++] = a; ++ } + } ++ + for (a = 0; a < got_nodes; a++){ + printf("%03d: ", node_to_use[a]); + if (numa_distance(node_to_use[a], node_to_use[a]) != 10) { +-- +2.7.4 + diff --git a/SOURCES/0004-Fix-regress-test-numastat-function-and-few-test-fixe.patch b/SOURCES/0004-Fix-regress-test-numastat-function-and-few-test-fixe.patch new file mode 100644 index 0000000..84ab6f0 --- /dev/null +++ b/SOURCES/0004-Fix-regress-test-numastat-function-and-few-test-fixe.patch @@ -0,0 +1,122 @@ +From 09d294e8d83151fb76a7fc741bc6251c0b171e25 Mon Sep 17 00:00:00 2001 +From: Harish +Date: Wed, 27 Jun 2018 22:29:10 +0530 +Subject: [PATCH 4/7] Fix: regress test numastat function and few test fixes + +nstat function previously assumed node indexes to be contiguous +and get the numastat of the required statname. When run on a +machine with combinations of memory/memory-less nodes in a +non-contiguous way, the test fetches wrong stats and fails. This +patch finds the index of the given node and returns proper value. + +Signed-off-by: Harish +Signed-off-by: Pingfan Liu +--- + test/regress | 42 +++++++++++++++++++++--------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +diff --git a/test/regress b/test/regress +index c0cf6d7..f06b22f 100755 +--- a/test/regress ++++ b/test/regress +@@ -47,9 +47,11 @@ failed() { + # nstat statname node + nstat() { + sleep $STAT_INTERVAL ++ nid=node$2 ++ id=`numastat | head -1 | awk -v node=$nid '{ for (i = 1; i <= NF; ++i) if($i==node) print i; exit }'` + declare -a fields + numastat | grep $1 | while read -a fields ; do +- echo ${fields[$[1 + $2]]} ++ echo ${fields[$id]} + done + } + +@@ -89,14 +91,13 @@ _test_process_state() { + test_process_state() + { + declare -i n0=${node[0]} n1=${node[1]} +- + _test_process_state --interleave=$n1 + +- a0=`nstat interleave_hit 0` +- a1=`nstat interleave_hit 1` ++ a0=`nstat interleave_hit $n0` ++ a1=`nstat interleave_hit $n1` + _test_process_state --interleave=$n0,$n1 +- b0=`nstat interleave_hit 0` +- b1=`nstat interleave_hit 1` ++ b0=`nstat interleave_hit $n0` ++ b1=`nstat interleave_hit $n1` + if [ $(expr $b1 - $a1) -lt $HALFPAGES ]; then + echo "interleaving test failed $n1 $b1 $a1" + failed +@@ -109,19 +110,18 @@ test_process_state() + _test_process_state --interleave=all + _test_process_state --membind=all + +- a=$(expr $(nstat numa_hit 0) + $(nstat numa_hit 1)) ++ a=$(expr $(nstat numa_hit $n0) + $(nstat numa_hit $n1)) + _test_process_state --membind=$n0,$n1 +- b=$(expr $(nstat numa_hit 0) + $(nstat numa_hit 1)) ++ b=$(expr $(nstat numa_hit $n0) + $(nstat numa_hit $n1)) + if [ $(expr $b - $a) -lt $PAGES ]; then + echo "membind test failed $n1 $b $a ($PAGES)" + failed + fi + +- for i in $(seq 0 $maxnode) ; do +- declare -i ni=${node[$i]} ++ for i in "${node[@]}" ; do + a=`nstat numa_hit $i` +- _test_process_state --membind=$ni +- _test_process_state --preferred=$ni ++ _test_process_state --membind=$i ++ _test_process_state --preferred=$i + b=`nstat numa_hit $i` + if [ $(expr $b - $a) -lt $DOUBLEPAGES ]; then + echo "membind/preferred on node $ni failed $b $a" +@@ -143,11 +143,11 @@ test_mbind() + { + declare -i n0=${node[0]} n1=${node[1]} + +- a0=`nstat interleave_hit 0` +- a1=`nstat interleave_hit 1` ++ a0=`nstat interleave_hit $n0` ++ a1=`nstat interleave_hit $n1` + _test_mbind interleave $n0,$n1 +- b0=`nstat interleave_hit 0` +- b1=`nstat interleave_hit 1` ++ b0=`nstat interleave_hit $n0` ++ b1=`nstat interleave_hit $n1` + if [ $(expr $b1 - $a1) -lt $HALFPAGES ]; then + echo "interleaving test 2 failed $n1 $b1 $a1 expected $HALFPAGES" + failed +@@ -159,19 +159,19 @@ test_mbind() + + _test_mbind interleave all + +- a=$(expr $(nstat numa_hit 0) + $(nstat numa_hit 1)) ++ a=$(expr $(nstat numa_hit $n0) + $(nstat numa_hit $n1)) + _test_mbind membind $n0,$n1 +- b=$(expr $(nstat numa_hit 0) + $(nstat numa_hit 1)) ++ b=$(expr $(nstat numa_hit $n0) + $(nstat numa_hit $n1)) + if [ $(expr $b - $a) -lt $PAGES ]; then + echo "membind test 2 failed $b $a ($PAGES)" + failed + fi + +- for i in $(seq 0 $maxnode) ; do ++ for i in "${node[@]}" ; do + declare -i ni=${node[$i]} + a=`nstat numa_hit $i` +- _test_mbind membind $ni +- _test_mbind preferred $ni ++ _test_mbind membind $i ++ _test_mbind preferred $i + b=`nstat numa_hit $i` + if [ $(expr $b - $a) -lt $DOUBLEPAGES ]; then + echo "membind/preferred test 2 on node $ni failed $b $a" +-- +2.7.4 + diff --git a/SOURCES/0005-Correct-calculation-of-nr_nodes-and-re-enable-move_p.patch b/SOURCES/0005-Correct-calculation-of-nr_nodes-and-re-enable-move_p.patch new file mode 100644 index 0000000..7f6a819 --- /dev/null +++ b/SOURCES/0005-Correct-calculation-of-nr_nodes-and-re-enable-move_p.patch @@ -0,0 +1,48 @@ +From d1bc1653b3f86b8951b876946a94db681764fa2a Mon Sep 17 00:00:00 2001 +From: Filipe Brandenburger +Date: Fri, 15 Jun 2018 14:16:23 -0700 +Subject: [PATCH 5/7] Correct calculation of nr_nodes and re-enable move_pages + test + +This was pointed out by @bjsprakash in #8. + +After the bug is corrected, we can re-enable the test in `make check`, +since most machines these days will have at least two nodes by default. + +Travis-CI still fails with this test (one node only available), so keep +skipping it there. + +Signed-off-by: Pingfan Liu +--- + Makefile.am | 1 + + test/move_pages.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 03b0ab6..1c4266d 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -134,6 +134,7 @@ TESTS = \ + test/checkaffinity \ + test/checktopology \ + test/distance \ ++ test/move_pages \ + test/nodemap \ + test/numademo \ + test/regress \ +diff --git a/test/move_pages.c b/test/move_pages.c +index 87d9b3e..c5010e2 100644 +--- a/test/move_pages.c ++++ b/test/move_pages.c +@@ -28,7 +28,7 @@ int main(int argc, char **argv) + + pagesize = getpagesize(); + +- nr_nodes = numa_max_node(); ++ nr_nodes = numa_max_node() + 1; + + if (nr_nodes < 2) { + printf("A minimum of 2 nodes is required for this test.\n"); +-- +2.7.4 + diff --git a/SOURCES/0006-Fix-move_pages-test-for-non-contiguous-nodes.patch b/SOURCES/0006-Fix-move_pages-test-for-non-contiguous-nodes.patch new file mode 100644 index 0000000..22be346 --- /dev/null +++ b/SOURCES/0006-Fix-move_pages-test-for-non-contiguous-nodes.patch @@ -0,0 +1,83 @@ +From bad479d2fe1075cfc83ffbd4ad39bcc6e800e7ca Mon Sep 17 00:00:00 2001 +From: Harish +Date: Thu, 5 Jul 2018 12:08:33 +0530 +Subject: [PATCH 6/7] Fix: move_pages test for non-contiguous nodes + +Patch fixes move_pages test for non-contiguous memory nodes and +distributed pages among existing memory nodes instead of assuming +continuous node IDs. + +Signed-off-by: Harish +Signed-off-by: Pingfan Liu +--- + test/move_pages.c | 28 +++++++++++++++++++++++++--- + 1 file changed, 25 insertions(+), 3 deletions(-) + +diff --git a/test/move_pages.c b/test/move_pages.c +index c5010e2..4b207e8 100644 +--- a/test/move_pages.c ++++ b/test/move_pages.c +@@ -21,6 +21,24 @@ int *status; + int *nodes; + int errors; + int nr_nodes; ++int *node_to_use; ++ ++int get_node_list() ++{ ++ int a, got_nodes = 0, max_node, numnodes; ++ long free_node_sizes; ++ ++ numnodes = numa_num_configured_nodes(); ++ node_to_use = (int *)malloc(numnodes * sizeof(int)); ++ max_node = numa_max_node(); ++ for (a = 0; a <= max_node; a++) { ++ if (numa_node_size(a, &free_node_sizes) > 0) ++ node_to_use[got_nodes++] = a; ++ } ++ if(got_nodes != numnodes) ++ return -1; ++ return got_nodes; ++} + + int main(int argc, char **argv) + { +@@ -28,12 +46,16 @@ int main(int argc, char **argv) + + pagesize = getpagesize(); + +- nr_nodes = numa_max_node() + 1; ++ nr_nodes = get_node_list(); + + if (nr_nodes < 2) { + printf("A minimum of 2 nodes is required for this test.\n"); + exit(1); + } ++ if (nr_nodes == -1) { ++ printf("Mismatch between congfigured nodes and memory-rich nodes.\n"); ++ exit(1); ++ } + + setbuf(stdout, NULL); + printf("move_pages() test ......\n"); +@@ -58,7 +80,7 @@ int main(int argc, char **argv) + /* We leave page 2 unallocated */ + pages[ i * pagesize ] = (char) i; + addr[i] = pages + i * pagesize; +- nodes[i] = (i % nr_nodes); ++ nodes[i] = node_to_use[(i % nr_nodes)]; + status[i] = -123; + } + +@@ -82,7 +104,7 @@ int main(int argc, char **argv) + if (i != 2) { + if (pages[ i* pagesize ] != (char) i) + errors++; +- else if (nodes[i] != (i % nr_nodes)) ++ else if (nodes[i] != node_to_use[(i % nr_nodes)]) + errors++; + } + } +-- +2.7.4 + diff --git a/SOURCES/0007-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch b/SOURCES/0007-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch new file mode 100644 index 0000000..e18c778 --- /dev/null +++ b/SOURCES/0007-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch @@ -0,0 +1,39 @@ +From a8f5ed65b745f96f5e5af72bace8e7c63b96fd4e Mon Sep 17 00:00:00 2001 +From: Sanskriti Sharma +Date: Thu, 13 Sep 2018 10:01:58 -0400 +Subject: [PATCH 7/7] Fix: Add ShmemHugePages and ShmemPmdMapped to + system_meminfo[] + +ShmemHugePages and ShmemPmdMapped were recently added to +/sys/devices/system/node/node*/meminfo. Adding entries for them in the +system_meminfo data structure got rid of the error "Token Node not in hash +table." + +Signed-off-by: Sanskriti Sharma +Signed-off-by: Pingfan Liu +--- + numastat.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/numastat.c b/numastat.c +index 92d8496..25874db 100644 +--- a/numastat.c ++++ b/numastat.c +@@ -122,9 +122,11 @@ meminfo_t system_meminfo[] = { + { 27, "SReclaimable", "SReclaimable" }, + { 28, "SUnreclaim", "SUnreclaim" }, + { 29, "AnonHugePages", "AnonHugePages" }, +- { 30, "HugePages_Total", "HugePages_Total" }, +- { 31, "HugePages_Free", "HugePages_Free" }, +- { 32, "HugePages_Surp", "HugePages_Surp" } ++ { 30, "ShmemHugePages", "ShmemHugePages" }, ++ { 31, "ShmemPmdMapped", "ShmemPmdMapped" }, ++ { 32, "HugePages_Total", "HugePages_Total" }, ++ { 33, "HugePages_Free", "HugePages_Free" }, ++ { 34, "HugePages_Surp", "HugePages_Surp" } + }; + + #define SYSTEM_MEMINFO_ROWS (sizeof(system_meminfo) / sizeof(system_meminfo[0])) +-- +2.7.4 + diff --git a/SPECS/numactl.spec b/SPECS/numactl.spec index 8b61cc4..ee57159 100644 --- a/SPECS/numactl.spec +++ b/SPECS/numactl.spec @@ -1,7 +1,7 @@ Name: numactl Summary: Library for tuning for Non Uniform Memory Access machines Version: 2.0.12 -Release: 2%{dist} +Release: 7%{?dist} # libnuma is LGPLv2 and GPLv2 # numactl binaries are GPLv2 only License: GPLv2 @@ -37,7 +37,14 @@ ExcludeArch: s390 %{arm} # # Patches 601 onward are generic patches # -Patch601: 0001-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch +Patch601 :0001-Fix-node_list-with-memory-less-nodes.patch +Patch602 :0002-numademo-fix-wrong-node-input.patch +Patch603 :0003-Fix-distance-test-to-include-all-existing-nodes.patch +Patch604 :0004-Fix-regress-test-numastat-function-and-few-test-fixe.patch +Patch605 :0005-Correct-calculation-of-nr_nodes-and-re-enable-move_p.patch +Patch606 :0006-Fix-move_pages-test-for-non-contiguous-nodes.patch +Patch607 :0007-Fix-Add-ShmemHugePages-and-ShmemPmdMapped-to-system_.patch + %description @@ -68,9 +75,16 @@ Provides development headers for numa library calls #patch %patch601 -p1 +%patch602 -p1 +%patch603 -p1 +%patch604 -p1 +%patch605 -p1 +%patch606 -p1 +%patch607 -p1 %build +aclocal && automake %configure --prefix=/usr --libdir=%{_libdir} make clean make CFLAGS="$RPM_OPT_FLAGS -I." @@ -112,6 +126,9 @@ make DESTDIR=$RPM_BUILD_ROOT install %{_mandir}/man3/*.3* %changelog +* Mon Apr 1 2019 Pingfan Liu - 2.0.12-3 +- add gating test cases + * Mon Nov 26 2018 Pingfan Liu - 2.0.12-2 - Fix: Add ShmemHugePages and ShmemPmdMapped to system_meminfo[]