From 6a98cdfd53658cf52319cb1270699103ae6b7dfc Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 11:10:08 +0000 Subject: import numactl-2.0.12-3.el7 --- diff --git a/.gitignore b/.gitignore index abf6b38..528b731 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/numactl-2.0.9.tar.gz +SOURCES/numactl-2.0.12.tar.gz diff --git a/.numactl.metadata b/.numactl.metadata index 42b45ba..f77fa54 100644 --- a/.numactl.metadata +++ b/.numactl.metadata @@ -1 +1 @@ -7231abc8f49e805225858ac08d801ade722f0b94 SOURCES/numactl-2.0.9.tar.gz +8576ef894d2c4d25adddd792593bcd92e711d86f SOURCES/numactl-2.0.12.tar.gz diff --git a/SOURCES/numactl-2.0.10-numa_node_to_cpu_skip_over_nonexisting.patch b/SOURCES/numactl-2.0.10-numa_node_to_cpu_skip_over_nonexisting.patch deleted file mode 100644 index 8e1af68..0000000 --- a/SOURCES/numactl-2.0.10-numa_node_to_cpu_skip_over_nonexisting.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 32075635db57c3d5efe12f8fb569af857e01ccad Mon Sep 17 00:00:00 2001 -From: Petr Holasek -Date: Wed, 14 Jan 2015 09:53:47 +0100 -Subject: [PATCH] libnuma: add check for return value of numa_node_to_cpus - -When numa_node_to_cpu() has been called on machine with non-contiguous -nodes, it returned the first node which wasn't present on machine. -Now, return code is checked and code skips over non-existing nodes to -the right one. - -Also, caching of numa_node_to_cpus_v2() result while non-zero error had -been returned was disabled. - -Signed-off-by: Petr Holasek - -Tested by Cliff Wickman (on attica.sgi.com) ---- - libnuma.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff -up numactl-2.0.9/libnuma.c.orig numactl-2.0.9/libnuma.c ---- numactl-2.0.9/libnuma.c.orig 2013-10-08 23:34:57.000000000 +0200 -+++ numactl-2.0.9/libnuma.c 2015-07-01 15:14:44.937178134 +0200 -@@ -1380,8 +1380,12 @@ numa_node_to_cpus_v2(int node, struct bi - if (mask != buffer) - numa_bitmask_free(mask); - } else { -- node_cpu_mask_v2[node] = mask; -- } -+ /* we don't want to cache faulty result */ -+ if (!err) -+ node_cpu_mask_v2[node] = mask; -+ else -+ numa_bitmask_free(mask); -+ } - return err; - } - __asm__(".symver numa_node_to_cpus_v2,numa_node_to_cpus@@libnuma_1.2"); -@@ -1403,7 +1407,10 @@ int numa_node_of_cpu(int cpu) - bmp = numa_bitmask_alloc(ncpus); - nnodes = numa_max_node(); - for (node = 0; node <= nnodes; node++){ -- numa_node_to_cpus_v2_int(node, bmp); -+ if (numa_node_to_cpus_v2_int(node, bmp) < 0) { -+ /* It's possible for the node to not exist */ -+ continue; -+ } - if (numa_bitmask_isbitset(bmp, cpu)){ - ret = node; - goto end; diff --git a/SOURCES/numactl-2.0.11-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch b/SOURCES/numactl-2.0.11-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch deleted file mode 100644 index a14b13f..0000000 --- a/SOURCES/numactl-2.0.11-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch +++ /dev/null @@ -1,131 +0,0 @@ -From b608687037d873ad82d6318f231b3d6612e8601d Mon Sep 17 00:00:00 2001 -From: Seeteena Thoufeek -Date: Wed, 21 Dec 2016 12:48:11 +0530 -Subject: [PATCH 1/1] Segment fault when numa nodes not sequential or - contiguous - -While trying to get stat of the guest process (configured with hugepages), numastat fails - -==================== -Environment details -==================== -Linux lep8b 4.8.0-30-generic #32-Ubuntu SMP Fri Dec 2 03:43:46 UTC 2016 ppc64le ppc64le ppc64le GNU/Linu - -===== -Issue -===== -2016-12-14 07:02:56,396 process L0368 INFO | Running 'numastat 61257' -2016-12-14 07:02:56,402 process L0462 DEBUG| [stderr] *** Error in `numastat': double free or corruption (out): 0x00000100265005a0 *** -2016-12-14 07:02:56,403 process L0462 DEBUG| [stdout] -2016-12-14 07:02:56,403 process L0482 INFO | Command 'numastat 61257' finished with -6 after 0.00309896469116s -2016-12-14 07:02:56,403 process L0462 DEBUG| [stdout] Per-node process memory usage (in MBs) for PID 61257 (qemu-system-ppc) -2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] ======= Backtrace: ========= -2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x86d54)[0x3fff9a736d54] -2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x93c30)[0x3fff9a743c30] -2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(cfree+0x68)[0x3fff9a748218] -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(fclose+0x1c8)[0x3fff9a727d68] -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] numastat(+0x7aa4)[0x401d7aa4] -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] numastat(+0x2388)[0x401d2388] -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x2291c)[0x3fff9a6d291c] -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(__libc_start_main+0xb8)[0x3fff9a6d2b18] -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] ======= Memory map: ======== -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] 401d0000-401e0000 r-xp 00000000 08:92 40325510 /usr/bin/numastat -2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] 401e0000-401f0000 r--p 00000000 08:92 40325510 /usr/bin/numastat -2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 401f0000-40200000 rw-p 00010000 08:92 40325510 /usr/bin/numastat -2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 10026500000-10026530000 rw-p 00000000 00:00 0 [heap] -2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a6b0000-3fff9a860000 r-xp 00000000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a860000-3fff9a870000 ---p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a870000-3fff9a880000 r--p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a880000-3fff9a890000 rw-p 001c0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a8b0000-3fff9a8c0000 rw-p 00000000 00:00 0 -2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a8c0000-3fff9a8e0000 r-xp 00000000 00:00 0 [vdso] -2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a8e0000-3fff9a920000 r-xp 00000000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so -2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a920000-3fff9a930000 r--p 00030000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so -2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a930000-3fff9a940000 rw-p 00040000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so -2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fffdd320000-3fffdd350000 rw-p 00000000 00:00 0 [stack] - -============= -Recreation Steps -============= -1. Configure host with hugepages -2. Start a guest and attach following memory device xml, - -83886080163840 -3. Set the rules in guest -4. execute numastat of guest pid - -Expected Result : -Provide PID numastat - -Per-node process memory usage (in MBs) for PID 55119 (qemu-system-ppc) -Node 0 Node 1 Node 16 ---------------- --------------- --------------- -Huge 0.00 0.00 0.00 -Heap 2.00 0.38 0.00 -Stack 0.00 0.00 0.00 -Private 31800.12 183.06 0.00 ----------------- --------------- --------------- --------------- -Total 31802.12 183.44 0.00 - -Node 17 Total ---------------- --------------- -Huge 0.00 0.00 -Heap 0.00 15.25 -Stack 0.00 0.06 -Private 0.00 33169.31 ----------------- --------------- --------------- -Total 0.00 34345.00 -*** Error in `numastat': free(): invalid next size (fast): 0x000001003f2c0580 *** -======= Backtrace: ========= -/lib/powerpc64le-linux-gnu/libc.so.6(+0x86d54)[0x3fff82866d54] -/lib/powerpc64le-linux-gnu/libc.so.6(+0x93c30)[0x3fff82873c30] -/lib/powerpc64le-linux-gnu/libc.so.6(cfree+0x68)[0x3fff82878218] -numastat(+0x4244)[0x5adc4244] -numastat(+0x7d24)[0x5adc7d24] -numastat(+0x2388)[0x5adc2388] -/lib/powerpc64le-linux-gnu/libc.so.6(+0x2291c)[0x3fff8280291c] -/lib/powerpc64le-linux-gnu/libc.so.6(__libc_start_main+0xb8)[0x3fff82802b18] -======= Memory map: ======== -5adc0000-5add0000 r-xp 00000000 08:92 40325510 /usr/bin/numastat -5add0000-5ade0000 r--p 00000000 08:92 40325510 /usr/bin/numastat -5ade0000-5adf0000 rw-p 00010000 08:92 40325510 /usr/bin/numastat -1003f2c0000-1003f2f0000 rw-p 00000000 00:00 0 [heap] -3fff827e0000-3fff82990000 r-xp 00000000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -3fff82990000-3fff829a0000 ---p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -3fff829a0000-3fff829b0000 r--p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -3fff829b0000-3fff829c0000 rw-p 001c0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so -3fff829e0000-3fff829f0000 rw-p 00000000 00:00 0 -3fff829f0000-3fff82a10000 r-xp 00000000 00:00 0 [vdso] -3fff82a10000-3fff82a50000 r-xp 00000000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so -3fff82a50000-3fff82a60000 r--p 00030000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so -3fff82a60000-3fff82a70000 rw-p 00040000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so -3fffc3b90000-3fffc3bc0000 rw-p 00000000 00:00 0 [stack] -Aborted - -Signed-off-by: Seeteena Thoufeek -Signed-off-by: Andi Kleen ---- - numastat.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/numastat.c b/numastat.c -index 1924dba..e0a5639 100644 ---- a/numastat.c -+++ b/numastat.c -@@ -1054,7 +1054,12 @@ void show_process_info() { - } else { - tmp_row = header_rows + pid_ix; - } -- int tmp_col = header_cols + node_num; -+ // Don't assume nodes are sequential or contiguous. -+ // Need to find correct tmp_col from node_ix_map -+ int i = 0; -+ while(node_ix_map[i++] != node_num) -+ ; -+ int tmp_col = header_cols + i - 1; - double_addto(&table, tmp_row, tmp_col, value); - double_addto(&table, tmp_row, total_col_ix, value); - double_addto(&table, total_row_ix, tmp_col, value); --- -2.14.0 - diff --git a/SOURCES/numactl-2.0.11-libnuma-supress-warnings-for-non-existing-node.patch b/SOURCES/numactl-2.0.11-libnuma-supress-warnings-for-non-existing-node.patch deleted file mode 100644 index 57c85ba..0000000 --- a/SOURCES/numactl-2.0.11-libnuma-supress-warnings-for-non-existing-node.patch +++ /dev/null @@ -1,60 +0,0 @@ -From a69169698c4c086b7a74602938b329fb055fdf60 Mon Sep 17 00:00:00 2001 -From: Petr Holasek -Date: Mon, 7 Dec 2015 15:32:29 +0100 -Subject: [PATCH] libnuma: supress warnings for non-existing node - -When calling numa_node_to_cpus on non-existing node number (e.g. for -non-contiguous node numbers), a bit confusing warning is supressed. Since -warnings are implemented as weak functions they cannot be overriden when -using dlsym interface. - -Signed-off-by: Petr Holasek ---- - libnuma.c | 24 ++++++++++++++---------- - 1 file changed, 14 insertions(+), 10 deletions(-) - -diff --git a/libnuma.c b/libnuma.c -index 3717d5b..549525c 100644 ---- a/libnuma.c -+++ b/libnuma.c -@@ -1276,11 +1276,13 @@ numa_node_to_cpus_v1(int node, unsigned long *buffer, int bufferlen) - sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node); - f = fopen(fn, "r"); - if (!f || getdelim(&line, &len, '\n', f) < 1) { -- numa_warn(W_nosysfs2, -- "/sys not mounted or invalid. Assuming one node: %s", -- strerror(errno)); -- numa_warn(W_nosysfs2, -- "(cannot open or correctly parse %s)", fn); -+ if (numa_bitmask_isbitset(numa_nodes_ptr, node)) { -+ numa_warn(W_nosysfs2, -+ "/sys not mounted or invalid. Assuming one node: %s", -+ strerror(errno)); -+ numa_warn(W_nosysfs2, -+ "(cannot open or correctly parse %s)", fn); -+ } - bitmask.maskp = (unsigned long *)mask; - bitmask.size = buflen_needed * 8; - numa_bitmask_setall(&bitmask); -@@ -1355,11 +1357,13 @@ numa_node_to_cpus_v2(int node, struct bitmask *buffer) - sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node); - f = fopen(fn, "r"); - if (!f || getdelim(&line, &len, '\n', f) < 1) { -- numa_warn(W_nosysfs2, -- "/sys not mounted or invalid. Assuming one node: %s", -- strerror(errno)); -- numa_warn(W_nosysfs2, -- "(cannot open or correctly parse %s)", fn); -+ if (numa_bitmask_isbitset(numa_nodes_ptr, node)) { -+ numa_warn(W_nosysfs2, -+ "/sys not mounted or invalid. Assuming one node: %s", -+ strerror(errno)); -+ numa_warn(W_nosysfs2, -+ "(cannot open or correctly parse %s)", fn); -+ } - numa_bitmask_setall(mask); - err = -1; - } --- -2.4.3 - diff --git a/SOURCES/numactl-2.0.12-numastat-when-reading-no-exist-pid-return-EXIT_FAILU.patch b/SOURCES/numactl-2.0.12-numastat-when-reading-no-exist-pid-return-EXIT_FAILU.patch new file mode 100644 index 0000000..ac5d632 --- /dev/null +++ b/SOURCES/numactl-2.0.12-numastat-when-reading-no-exist-pid-return-EXIT_FAILU.patch @@ -0,0 +1,36 @@ +From 0707807bad2106598d5a73e0adec7ae3c3de284f Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Tue, 21 May 2019 14:13:28 +0800 +Subject: [PATCH] numastat: when reading no-exist pid, return EXIT_FAILURE + +This ease the result query by $? + +Signed-off-by: Pingfan Liu +--- + numastat.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/numastat.c b/numastat.c +index 263bddf..f1a3cc1 100644 +--- a/numastat.c ++++ b/numastat.c +@@ -956,6 +956,8 @@ void show_process_info() { + if (!fs) { + sprintf(buf, "Can't read /proc/%d/numa_maps", pid); + perror(buf); ++ if (num_pids == 1) ++ exit(EXIT_FAILURE); + continue; + } + // Add up sub-category memory used from each node. Must go line by line +@@ -1023,6 +1025,7 @@ void show_process_info() { + if (ferror(fs)) { + sprintf(buf, "Can't read /proc/%d/numa_maps", pid); + perror(buf); ++ exit(EXIT_FAILURE); + } + fclose(fs); + // If showing individual tables, or we just added the last total line, +-- +2.7.5 + diff --git a/SOURCES/numactl-2.0.8-localalloc-man.patch b/SOURCES/numactl-2.0.8-localalloc-man.patch deleted file mode 100644 index d0b09de..0000000 --- a/SOURCES/numactl-2.0.8-localalloc-man.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -up numactl-2.0.8/numactl.8.orig numactl-2.0.8/numactl.8 ---- numactl-2.0.8/numactl.8.orig 2013-08-19 18:09:06.810007252 +0200 -+++ numactl-2.0.8/numactl.8 2013-08-19 18:09:36.746029049 +0200 -@@ -153,7 +153,11 @@ A !N-N notation indicates the inverse of - except N-N. If used with + notation, specify !+N-N. - .TP - .B \-\-localalloc, \-l --Always allocate on the current node. -+Falls back to the system default which is local allocation by using -+.I MPOL_DEFAULT -+policy. See -+.I mbind(2) -+for details. - .TP - .B \-\-preferred=node - Preferably allocate memory on -diff -up numactl-2.0.8/numactl.8.orig.orig numactl-2.0.8/numactl.8.orig diff --git a/SOURCES/numactl-2.0.9-hw-detect-segfault.patch b/SOURCES/numactl-2.0.9-hw-detect-segfault.patch deleted file mode 100644 index 1ab8267..0000000 --- a/SOURCES/numactl-2.0.9-hw-detect-segfault.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Elena Ufimtseva -To: linux-numa@vger.kernel.org -Cc: cpw@sgi.com, Elena Ufimtseva -Subject: [PATCH] numactl: checks for numa when showing hardware -Date: Sat, 23 Nov 2013 03:10:41 -0500 - -Checks if NUMA is available before printing hardware, -otherwise segfault occurs. - -Signed-off-by: Elena Ufimtseva ---- - numactl.c | 5 +++++ - 1 files changed, 5 insertions(+), 0 deletions(-) - -diff --git a/numactl.c b/numactl.c -index 97955a4..f30b53c 100755 ---- a/numactl.c -+++ b/numactl.c -@@ -242,6 +242,11 @@ void hardware(void) - int prevnode=-1; - int skip=0; - int maxnode = numa_max_node(); -+ -+ if (numa_available() < 0) { -+ printf("No NUMA available on this system\n"); -+ exit(1); -+ } - - for (i=0; i<=maxnode; i++) - if (numa_bitmask_isbitset(numa_nodes_ptr, i)) diff --git a/SOURCES/numactl-2.0.9-mpol-bind-preferred.patch b/SOURCES/numactl-2.0.9-mpol-bind-preferred.patch deleted file mode 100644 index d3f8427..0000000 --- a/SOURCES/numactl-2.0.9-mpol-bind-preferred.patch +++ /dev/null @@ -1,312 +0,0 @@ -Date: Tue, 15 Jul 2014 13:53:14 -0400 -From: Bill Gray -To: linux-numa@vger.kernel.org -Cc: Cliff Wickman -Subject: [PATCH] Fix numactl --show preferred node for case MPOL_BIND - -This patch is mostly to fix an issue in "numactl --show" which did not -print the correct preferred node: - -# for i in 0 1 2 3 4 5 6 7 ; do numactl -N$i -m$i numactl -s; done | -grep preferred -preferred node: 4 -preferred node: 4 -preferred node: 4 -preferred node: 4 -preferred node: 4 -preferred node: 4 -preferred node: 4 -preferred node: 4 - -# for i in 0 1 2 3 4 5 6 7 ; do ./numactl -N$i -m$i ./numactl -s; done | -grep preferred -preferred node: 0 -preferred node: 1 -preferred node: 2 -preferred node: 3 -preferred node: 4 -preferred node: 5 -preferred node: 6 -preferred node: 7 - -Patch Changes: -- eliminated bitops.[cho] -- eliminated redundant printcpumask() (which duplicated printmask()) -- added find_first() to util.[ch] -- fixed some compiler warnings - -These files can be deleted: -- Only in numactl-2.0.9-orig/: bitops.c -- Only in numactl-2.0.9-orig/: bitops.h -- Only in numactl-2.0.9-orig/: numastat -- Only in numactl-2.0.9-orig/test: move_pages - -diffstats: - Makefile | 12 ++++++------ - bitops.c | 13 ------------- - bitops.h | 13 ------------- - migspeed.c | 4 +--- - numactl.c | 5 ++--- - numaint.h | 2 +- - test/move_pages |binary - Makefile | 12 ++++++------ - bitops.c | 13 ------------- - bitops.h | 13 ------------- - migspeed.c | 4 +--- - numactl.c | 5 ++--- - numaint.h | 2 +- - test/nodemap.c | 1 - - test/tbitmap.c | 10 +++++++++- - util.c | 14 +++++--------- - util.h | 2 +- - 10 files changed, 25 insertions(+), 51 deletions(-) - -Signed-off-by: Bill Gray - -Index: numactl-dev/bitops.c -=================================================================== ---- numactl-dev.orig/bitops.c -+++ /dev/null -@@ -1,13 +0,0 @@ --#include "bitops.h" -- --/* extremly dumb */ --int find_first_bit(void *m, int max) --{ -- unsigned long *mask = m; -- int i; -- for (i = 0; i < max; i++) { -- if (test_bit(i, mask)) -- break; -- } -- return i; --} -Index: numactl-dev/bitops.h -=================================================================== ---- numactl-dev.orig/bitops.h -+++ /dev/null -@@ -1,13 +0,0 @@ --#ifndef BITOPS_H --#define BITOPS_H 1 -- --#define BITS_PER_LONG (sizeof(unsigned long) * 8) --#define BYTES_PER_LONG (sizeof(long)) -- --#define test_bit(i,p) ((p)[(i) / BITS_PER_LONG] & (1UL << ((i)%BITS_PER_LONG))) --#define set_bit(i,p) ((p)[(i) / BITS_PER_LONG] |= (1UL << ((i)%BITS_PER_LONG))) --#define clear_bit(i,p) ((p)[(i) / BITS_PER_LONG] &= ~(1UL << ((i)%BITS_PER_LONG))) -- --extern int find_first_bit(void *mask, int max); -- --#endif -Index: numactl-dev/Makefile -=================================================================== ---- numactl-dev.orig/Makefile -+++ numactl-dev/Makefile -@@ -23,7 +23,7 @@ ifeq ($(THREAD_SUPPORT),yes) - endif - - CLEANFILES := numactl.o libnuma.o numactl numademo numademo.o distance.o \ -- memhog libnuma.so libnuma.so.1 numamon numamon.o syscall.o bitops.o \ -+ memhog libnuma.so libnuma.so.1 numamon numamon.o syscall.o \ - memhog.o util.o stream_main.o stream_lib.o shm.o stream clearcache.o \ - test/pagesize test/tshared test/mynode.o test/tshared.o mt.o empty.o empty.c \ - test/mynode test/ftok test/prefered test/randmap \ -@@ -32,8 +32,8 @@ CLEANFILES := numactl.o libnuma.o numact - test/mbind_mig_pages test/migrate_pages \ - migratepages migspeed migspeed.o libnuma.a \ - test/move_pages test/realloc_test sysfs.o affinity.o \ -- test/node-parse rtnetlink.o test/A numastat --SOURCES := bitops.c libnuma.c distance.c memhog.c numactl.c numademo.c \ -+ test/node-parse rtnetlink.o test/A numastat numastat.o -+SOURCES := libnuma.c distance.c memhog.c numactl.c numademo.c \ - numamon.c shm.c stream_lib.c stream_main.c syscall.c util.c mt.c \ - clearcache.c test/*.c affinity.c sysfs.c rtnetlink.c numastat.c - -@@ -51,11 +51,11 @@ all: numactl migratepages migspeed libnu - test/mbind_mig_pages test/migrate_pages test/realloc_test libnuma.a \ - test/node-parse numastat - --numactl: numactl.o util.o shm.o bitops.o libnuma.so -+numactl: numactl.o util.o shm.o libnuma.so - - numastat: CFLAGS += -std=gnu99 - --migratepages: migratepages.c util.o bitops.o libnuma.so -+migratepages: migratepages.c util.o libnuma.so - - migspeed: LDLIBS += -lrt - migspeed: migspeed.o util.o libnuma.so -@@ -129,7 +129,7 @@ test/nodemap: test/nodemap.c libnuma.so - - test/distance: test/distance.c libnuma.so - --test/tbitmap: test/tbitmap.c libnuma.so -+test/tbitmap: test/tbitmap.c libnuma.so util.o - - test/move_pages: test/move_pages.c libnuma.so - -Index: numactl-dev/migspeed.c -=================================================================== ---- numactl-dev.orig/migspeed.c -+++ numactl-dev/migspeed.c -@@ -65,7 +65,6 @@ int main(int argc, char *argv[]) - { - char *p; - int option; -- int error = 0; - struct timespec result; - unsigned long bytes; - double duration, mbytes; -@@ -82,8 +81,7 @@ int main(int argc, char *argv[]) - switch (option) { - case 'h' : - case '?' : -- error = 1; -- break; -+ usage(); - case 'v' : - verbose++; - break; -Index: numactl-dev/numactl.c -=================================================================== ---- numactl-dev.orig/numactl.c -+++ numactl-dev/numactl.c -@@ -119,7 +119,7 @@ void show_physcpubind(void) - } - err("sched_get_affinity"); - } -- printcpumask("physcpubind", cpubuf); -+ printmask("physcpubind", cpubuf); - break; - } - } -@@ -130,7 +130,6 @@ void show(void) - struct bitmask *membind, *interleave, *cpubind; - unsigned long cur; - int policy; -- int numa_num_nodes = numa_num_possible_nodes(); - - if (numa_available() < 0) { - show_physcpubind(); -@@ -166,7 +165,7 @@ void show(void) - printf("%ld (interleave next)\n",cur); - break; - case MPOL_BIND: -- printf("%d\n", find_first_bit(&membind, numa_num_nodes)); -+ printf("%d\n", find_first(membind)); - break; - } - if (policy == MPOL_INTERLEAVE) { -Index: numactl-dev/numaint.h -=================================================================== ---- numactl-dev.orig/numaint.h -+++ numactl-dev/numaint.h -@@ -1,5 +1,4 @@ - /* Internal interfaces of libnuma */ --#include "bitops.h" - - extern int numa_sched_setaffinity_v1(pid_t pid, unsigned len, const unsigned long *mask); - extern int numa_sched_getaffinity_v1(pid_t pid, unsigned len, const unsigned long *mask); -@@ -12,6 +11,7 @@ extern int numa_sched_getaffinity_v2_int - - #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ - -+#define BITS_PER_LONG (sizeof(unsigned long) * 8) - #define CPU_BYTES(x) (round_up(x, BITS_PER_LONG)/8) - #define CPU_LONGS(x) (CPU_BYTES(x) / sizeof(long)) - -Index: numactl-dev/test/nodemap.c -=================================================================== ---- numactl-dev.orig/test/nodemap.c -+++ numactl-dev/test/nodemap.c -@@ -1,5 +1,4 @@ - #include "numa.h" --#include "bitops.h" - #include - #include - -Index: numactl-dev/test/tbitmap.c -=================================================================== ---- numactl-dev.orig/test/tbitmap.c -+++ numactl-dev/test/tbitmap.c -@@ -7,6 +7,13 @@ - #include - #include - #include "numa.h" -+#include "util.h" -+ -+/* For util.c. Fixme. */ -+void usage(void) -+{ -+ exit(1); -+} - - #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) - -@@ -81,11 +88,12 @@ int main(void) - numa_bitmask_clearall(mask); - numa_bitmask_clearall(mask2); - numa_bitmask_setbit(mask, i); -+ assert(find_first(mask) == i); - bitmap_scnprintf(buf, sizeof(buf), mask); - strcat(buf,"\n"); - if (numa_parse_bitmap(buf, mask2) < 0) - assert(0); -- if (memcmp(mask, mask2, sizeof(mask))) { -+ if (memcmp(mask->maskp, mask2->maskp, numa_bitmask_nbytes(mask))) { - bitmap_scnprintf(buf, sizeof(buf), mask2); - printf("mask2 differs: %s\n", buf); - assert(0); -Index: numactl-dev/util.c -=================================================================== ---- numactl-dev.orig/util.c -+++ numactl-dev/util.c -@@ -16,7 +16,6 @@ - #include "numa.h" - #include "numaif.h" - #include "util.h" --#include "bitops.h" - #include - #include - #include -@@ -28,23 +27,20 @@ - void printmask(char *name, struct bitmask *mask) - { - int i; -- - printf("%s: ", name); -- for (i = 0; i <= mask->size; i++) -+ for (i = 0; i < mask->size; i++) - if (numa_bitmask_isbitset(mask, i)) - printf("%d ", i); - putchar('\n'); - } - --void printcpumask(char *name, struct bitmask *mask) -+int find_first(struct bitmask *mask) - { - int i; -- printf("%s: ", name); -- for (i = 0; i < mask->size; i++) { -+ for (i = 0; i < mask->size; i++) - if (numa_bitmask_isbitset(mask, i)) -- printf("%d ", i); -- } -- putchar('\n'); -+ return i; -+ return -1; - } - - void complain(char *fmt, ...) -Index: numactl-dev/util.h -=================================================================== ---- numactl-dev.orig/util.h -+++ numactl-dev/util.h -@@ -1,5 +1,5 @@ - extern void printmask(char *name, struct bitmask *mask); --extern void printcpumask(char *name, struct bitmask *mask); -+extern int find_first(struct bitmask *mask); - extern struct bitmask *nodemask(char *s); - extern struct bitmask *cpumask(char *s, int *ncpus); - extern int read_sysctl(char *name); diff --git a/SPECS/numactl.spec b/SPECS/numactl.spec index 9164123..db0d7f5 100644 --- a/SPECS/numactl.spec +++ b/SPECS/numactl.spec @@ -1,23 +1,19 @@ Name: numactl Summary: Library for tuning for Non Uniform Memory Access machines -Version: 2.0.9 -Release: 7%{?dist} +Version: 2.0.12 +Release: 3%{?dist} # libnuma is LGPLv2 and GPLv2 # numactl binaries are GPLv2 only License: GPLv2 Group: System Environment/Base -URL: ftp://oss.sgi.com/www/projects/libnuma/download -Source0: ftp://oss.sgi.com/www/projects/libnuma/download/numactl-%{version}.tar.gz +URL: https://github.com/numactl/numactl +Source0: https://github.com/numactl/numactl/releases/download/%{version}/numactl-%{version}.tar.gz Buildroot: %{_tmppath}/%{name}-buildroot +BuildRequires: libtool automake autoconf ExcludeArch: s390 s390x %{arm} -Patch1: numactl-2.0.8-localalloc-man.patch -Patch2: numactl-2.0.9-hw-detect-segfault.patch -Patch3: numactl-2.0.9-mpol-bind-preferred.patch -Patch4: numactl-2.0.10-numa_node_to_cpu_skip_over_nonexisting.patch -Patch5: numactl-2.0.11-libnuma-supress-warnings-for-non-existing-node.patch -Patch6: numactl-2.0.11-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch +Patch1: numactl-2.0.12-numastat-when-reading-no-exist-pid-return-EXIT_FAILU.patch %description Simple NUMA policy support. It consists of a numactl program to run @@ -45,27 +41,16 @@ Provides development headers for numa library calls %prep %setup -q -n %{name}-%{version} %patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 %build +%configure --prefix=/usr --libdir=%{_libdir} make clean make CFLAGS="$RPM_OPT_FLAGS -I." %install rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_bindir} -mkdir -p $RPM_BUILD_ROOT%{_libdir} -mkdir -p $RPM_BUILD_ROOT%{_includedir} -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8 -make prefix=$RPM_BUILD_ROOT/usr libdir=$RPM_BUILD_ROOT/%{_libdir} install - -%clean -rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install %post -p /sbin/ldconfig %post libs -p /sbin/ldconfig @@ -74,8 +59,7 @@ rm -rf $RPM_BUILD_ROOT %postun libs -p /sbin/ldconfig %files -%defattr(-,root,root,-) -%doc README +%doc README.md %{_bindir}/numactl %{_bindir}/numademo %{_bindir}/numastat @@ -83,21 +67,30 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/migspeed %{_bindir}/migratepages %{_mandir}/man8/*.8* +%exclude %{_mandir}/man2/*.2* %files libs -%defattr(-,root,root,-) +%{_libdir}/libnuma.so.1.0.0 %{_libdir}/libnuma.so.1 %files devel -%defattr(-,root,root,-) %{_libdir}/libnuma.so +%{_libdir}/pkgconfig/numa.pc %exclude %{_libdir}/libnuma.a +%exclude %{_libdir}/libnuma.la %{_includedir}/numa.h %{_includedir}/numaif.h %{_includedir}/numacompat1.h %{_mandir}/man3/*.3* %changelog +* Sat Jun 1 2019 Pingfan Liu - 2.0.12-3 +- numastat: bail out if reading no-exist pid + +* Fri May 31 2019 Pingfan Liu - 2.0.12-2 +- numastat: when reading no-exist pid, return EXIT_FAILURE +- Rebase to numactl-2.0.12 + * Tue Aug 8 2017 Petr Oros - 2.0.9-7 - Segment fault when numa nodes not sequential or contiguous - Resolves: #1219445