From 42f3e68eff4880d8a3d5e911c3c3dfe8ee5e0515 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Fri, 20 Dec 2024 13:38:59 +0300 Subject: [PATCH] import numactl-2.0.19-1.el10 --- .gitignore | 2 +- .numactl.metadata | 2 +- ...-for-set_mempolicy_home_node-syscall.patch | 30 --- ...ed-interleave-for-weighted-interleav.patch | 149 ----------- ...the-using-of-the-uninitialized-value.patch | 26 -- ...04-numactl-Fix-RESOURCE_LEAK-in-show.patch | 28 -- ...ocumentation-for-weighted-interleave.patch | 80 ------ ...-when-set_mempolicy_home_node-syscal.patch | 45 ---- ...numastat-eliminate-hard-coded-tables.patch | 243 ------------------ SOURCES/0008-Update-numactl.c.patch | 41 --- SPECS/numactl.spec | 24 +- 11 files changed, 15 insertions(+), 655 deletions(-) delete mode 100644 SOURCES/0001-Fix-fallback-for-set_mempolicy_home_node-syscall.patch delete mode 100644 SOURCES/0002-Add-w-and-weighted-interleave-for-weighted-interleav.patch delete mode 100644 SOURCES/0003-numademo-Fix-the-using-of-the-uninitialized-value.patch delete mode 100644 SOURCES/0004-numactl-Fix-RESOURCE_LEAK-in-show.patch delete mode 100644 SOURCES/0005-numactl-Add-documentation-for-weighted-interleave.patch delete mode 100644 SOURCES/0006-Don-t-fail-build-when-set_mempolicy_home_node-syscal.patch delete mode 100644 SOURCES/0007-numastat-eliminate-hard-coded-tables.patch delete mode 100644 SOURCES/0008-Update-numactl.c.patch diff --git a/.gitignore b/.gitignore index 9bb9a94..1bb817f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/numactl-2.0.18.tar.gz +SOURCES/numactl-2.0.19.tar.gz diff --git a/.numactl.metadata b/.numactl.metadata index afd6a5c..a98d406 100644 --- a/.numactl.metadata +++ b/.numactl.metadata @@ -1 +1 @@ -bbbdd7b7d0601d6076fa35c9f2dccb1005924e9c SOURCES/numactl-2.0.18.tar.gz +661a2cf7ad9f3f8e31e52ecf5017e521e7b97028 SOURCES/numactl-2.0.19.tar.gz diff --git a/SOURCES/0001-Fix-fallback-for-set_mempolicy_home_node-syscall.patch b/SOURCES/0001-Fix-fallback-for-set_mempolicy_home_node-syscall.patch deleted file mode 100644 index 7ac0510..0000000 --- a/SOURCES/0001-Fix-fallback-for-set_mempolicy_home_node-syscall.patch +++ /dev/null @@ -1,30 +0,0 @@ -From a7552a144f922031a14426b84056fa28c4cc3960 Mon Sep 17 00:00:00 2001 -From: Andi Kleen -Date: Sun, 11 Feb 2024 11:31:50 -0800 -Subject: [PATCH 1/8] Fix fallback for set_mempolicy_home_node syscall - -Correct the syscall number for the fallback. -Add a lot of architectures that support it with the same number to the -ifdef. - -Fixes #214 ---- - syscall.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/syscall.c b/syscall.c -index 63b3e53..a8fe81c 100644 ---- a/syscall.c -+++ b/syscall.c -@@ -141,7 +141,7 @@ - - #if !defined(__NR_set_mempolicy_home_node) - --#if defined(__x86_64__) || defined(__aarch64__) -+#if defined(__x86_64__) || defined(__aarch64__) || defined(__i386__) || defined(__powerpc__) || defined(__mips__) || defined(__s390x__) - #define __NR_set_mempolicy_home_node 450 - #else - #error "Add syscalls for your architecture or update kernel headers" --- -2.41.0 - diff --git a/SOURCES/0002-Add-w-and-weighted-interleave-for-weighted-interleav.patch b/SOURCES/0002-Add-w-and-weighted-interleave-for-weighted-interleav.patch deleted file mode 100644 index edb63d2..0000000 --- a/SOURCES/0002-Add-w-and-weighted-interleave-for-weighted-interleav.patch +++ /dev/null @@ -1,149 +0,0 @@ -From b67fb88e77b3c200b0e300e2e0edc4f66c1d9ea5 Mon Sep 17 00:00:00 2001 -From: Gregory Price -Date: Tue, 5 Dec 2023 17:04:39 +0000 -Subject: [PATCH 2/8] Add `-w` and `--weighted-interleave` for weighted - interleave mode - -Usage is `numactl --weighted-interleave=[...nodes...]` - -The logic is the exact same as the `--interleave` logic, and so we -simply add the 'w' case, update a single bit flip, and fall-through -to the --interleave case. - -Weights are set via /sys/kernel/mm/mempolicy/weighted_interleave - -Signed-off-by: Gregory Price ---- - VERSION | 2 +- - libnuma.c | 9 +++++++++ - numa.h | 3 +++ - numactl.c | 18 +++++++++++++++--- - numaif.h | 3 ++- - versions.ldscript | 7 +++++++ - 6 files changed, 37 insertions(+), 5 deletions(-) - -diff --git a/VERSION b/VERSION -index c945ef1..879b416 100644 ---- a/VERSION -+++ b/VERSION -@@ -1 +1 @@ --2.0.18 -+2.1 -diff --git a/libnuma.c b/libnuma.c -index 5340261..89a17e0 100644 ---- a/libnuma.c -+++ b/libnuma.c -@@ -1033,6 +1033,15 @@ numa_set_interleave_mask_v2(struct bitmask *bmp) - setpol(MPOL_INTERLEAVE, bmp); - } - -+void -+numa_set_weighted_interleave_mask(struct bitmask *bmp) -+{ -+ if (numa_bitmask_equal(bmp, numa_no_nodes_ptr)) -+ setpol(MPOL_DEFAULT, bmp); -+ else -+ setpol(MPOL_WEIGHTED_INTERLEAVE, bmp); -+} -+ - SYMVER("numa_get_interleave_mask_v1", "numa_get_interleave_mask@libnuma_1.1") - nodemask_t - numa_get_interleave_mask_v1(void) -diff --git a/numa.h b/numa.h -index fae15c5..9583bc4 100644 ---- a/numa.h -+++ b/numa.h -@@ -172,6 +172,9 @@ void numa_bind(struct bitmask *nodes); - /* Set the NUMA node interleaving mask. 0 to turn off interleaving */ - void numa_set_interleave_mask(struct bitmask *nodemask); - -+/* Set the NUMA node weighted interleaving mask. 0 to turn off */ -+void numa_set_weighted_interleave_mask(struct bitmask *nodemask); -+ - /* Return the current interleaving mask */ - struct bitmask *numa_get_interleave_mask(void); - -diff --git a/numactl.c b/numactl.c -index e765b6d..16a90a0 100755 ---- a/numactl.c -+++ b/numactl.c -@@ -43,6 +43,7 @@ enum { - static struct option opts[] = { - {"all", 0, 0, 'a'}, - {"interleave", 1, 0, 'i' }, -+ {"weighted-interleave", 1, 0, 'w' }, - {"preferred", 1, 0, 'p' }, - {"preferred-many", 1, 0, 'P' }, - {"cpubind", 1, 0, 'c' }, -@@ -479,6 +480,7 @@ int main(int ac, char **av) - int parse_all = 0; - int numa_balancing = 0; - int do_hardware = 0; -+ int weighted_interleave = 0; - - get_short_opts(opts,shortopts); - while ((c = getopt_long(ac, av, shortopts, opts, NULL)) != -1) { -@@ -494,6 +496,9 @@ int main(int ac, char **av) - nopolicy(); - numa_balancing = 1; - break; -+ case 'w': /* --weighted-interleave */ -+ weighted_interleave = 1; -+ /* fall-through - logic is the same as interleave */ - case 'i': /* --interleave */ - checknuma(); - if (parse_all) -@@ -507,11 +512,18 @@ int main(int ac, char **av) - - errno = 0; - did_node_cpu_parse = 1; -- setpolicy(MPOL_INTERLEAVE); -+ if (weighted_interleave) -+ setpolicy(MPOL_WEIGHTED_INTERLEAVE); -+ else -+ setpolicy(MPOL_INTERLEAVE); - if (shmfd >= 0) - numa_interleave_memory(shmptr, shmlen, mask); -- else -- numa_set_interleave_mask(mask); -+ else { -+ if (weighted_interleave) -+ numa_set_weighted_interleave_mask(mask); -+ else -+ numa_set_interleave_mask(mask); -+ } - checkerror("setting interleave mask"); - break; - case 'N': /* --cpunodebind */ -diff --git a/numaif.h b/numaif.h -index d2c9f64..adbdf9e 100644 ---- a/numaif.h -+++ b/numaif.h -@@ -31,7 +31,8 @@ extern int set_mempolicy_home_node(void *start, unsigned long len, - #define MPOL_INTERLEAVE 3 - #define MPOL_LOCAL 4 - #define MPOL_PREFERRED_MANY 5 --#define MPOL_MAX 6 -+#define MPOL_WEIGHTED_INTERLEAVE 6 -+#define MPOL_MAX 7 - - /* Flags for set_mempolicy, specified in mode */ - #define MPOL_F_NUMA_BALANCING (1 << 13) /* Optimize with NUMA balancing if possible */ -diff --git a/versions.ldscript b/versions.ldscript -index caa7c75..769294b 100644 ---- a/versions.ldscript -+++ b/versions.ldscript -@@ -172,3 +172,10 @@ libnuma_1.7{ - local: - *; - } libnuma_1.6; -+ -+libnuma_2.1{ -+ global: -+ numa_set_weighted_interleave_mask; -+ local: -+ *; -+} libnuma_1.7; --- -2.41.0 - diff --git a/SOURCES/0003-numademo-Fix-the-using-of-the-uninitialized-value.patch b/SOURCES/0003-numademo-Fix-the-using-of-the-uninitialized-value.patch deleted file mode 100644 index 87cf138..0000000 --- a/SOURCES/0003-numademo-Fix-the-using-of-the-uninitialized-value.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 119eb590f5f0b89611d46cdec805b22767f8a6c0 Mon Sep 17 00:00:00 2001 -From: Pingfan Liu -Date: Wed, 17 Apr 2024 10:36:34 +0800 -Subject: [PATCH 3/8] numademo: Fix the using of the uninitialized value - -Signed-off-by: Pingfan Liu ---- - numademo.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/numademo.c b/numademo.c -index 355b269..6f076ee 100644 ---- a/numademo.c -+++ b/numademo.c -@@ -250,6 +250,8 @@ static void memtest(char *name, unsigned char *mem) - - #endif - default: -+ gettimeofday(&start,NULL); -+ gettimeofday(&end,NULL); - break; - } - --- -2.41.0 - diff --git a/SOURCES/0004-numactl-Fix-RESOURCE_LEAK-in-show.patch b/SOURCES/0004-numactl-Fix-RESOURCE_LEAK-in-show.patch deleted file mode 100644 index fcbcafa..0000000 --- a/SOURCES/0004-numactl-Fix-RESOURCE_LEAK-in-show.patch +++ /dev/null @@ -1,28 +0,0 @@ -From ece7e227aeda655297f374f78834574badeb54c5 Mon Sep 17 00:00:00 2001 -From: Pingfan Liu -Date: Wed, 17 Apr 2024 10:53:56 +0800 -Subject: [PATCH 4/8] numactl: Fix RESOURCE_LEAK in show() - -Although exit() is called immediately after show(), it is better to keep -the malloc/free pair practice. - -Signed-off-by: Pingfan Liu ---- - numactl.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/numactl.c b/numactl.c -index 16a90a0..37949de 100755 ---- a/numactl.c -+++ b/numactl.c -@@ -196,6 +196,7 @@ static void show(void) - printmask("nodebind", cpubind); - printmask("membind", membind); - printmask("preferred", preferred); -+ numa_bitmask_free(preferred); - } - - static char *fmt_mem(unsigned long long mem, char *buf) --- -2.41.0 - diff --git a/SOURCES/0005-numactl-Add-documentation-for-weighted-interleave.patch b/SOURCES/0005-numactl-Add-documentation-for-weighted-interleave.patch deleted file mode 100644 index 11e2158..0000000 --- a/SOURCES/0005-numactl-Add-documentation-for-weighted-interleave.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 4bfdcc6e6111c5bf5d4ccb46f227aea80cc57159 Mon Sep 17 00:00:00 2001 -From: Honggyu Kim -Date: Fri, 19 Apr 2024 22:37:42 +0900 -Subject: [PATCH 5/8] numactl: Add documentation for weighted interleave - -Since --weighted-interleave/-w option was added to numactl at b67fb88, -we should add the description to help message and man page. - -Signed-off-by: Honggyu Kim ---- - numactl.8 | 12 ++++++++++++ - numactl.c | 8 +++++--- - 2 files changed, 17 insertions(+), 3 deletions(-) - -diff --git a/numactl.8 b/numactl.8 -index 594ccc7..053c7b1 100644 ---- a/numactl.8 -+++ b/numactl.8 -@@ -29,6 +29,8 @@ numactl \- Control NUMA policy for processes or shared memory - ] [ - .B \-\-interleave nodes - ] [ -+.B \-\-weighted\-interleave nodes -+] [ - .B \-\-preferred node - ] [ - .B \-\-preferred-many nodes -@@ -127,6 +129,13 @@ When memory cannot be allocated on the current interleave target fall back - to other nodes. - Multiple nodes may be specified on --interleave, --membind and --cpunodebind. - .TP -+.B \-\-weighted\-interleave=nodes, \-w nodes -+Set a weighted memory interleave policy. Memory will be allocated using the -+weighted ratio for each node, which can be read from -+.I /sys/kernel/mm/mempolicy/weighted_interleave/node*. -+When memory cannot be allocated on the current interleave target fall back -+to other nodes. -+.TP - .B \-\-membind=nodes, \-m nodes - Only allocate memory from nodes. Allocation will fail when there - is not enough memory available on these nodes. -@@ -298,6 +307,9 @@ Run myapplic on cpus 0-4 and 8-12 of the current cpuset. - numactl \-\-interleave=all bigdatabase arguments - Run big database with its memory interleaved on all CPUs. - -+numactl \-\-weighted\-interleave=all bigdatabase arguments -+Run big database with its memory interleaved with weighted ratio on all CPUs. -+ - numactl \-\-cpunodebind=0 \-\-membind=0,1 process - Run process on node 0 with memory allocated on node 0 and 1. - -diff --git a/numactl.c b/numactl.c -index 37949de..64980f3 100755 ---- a/numactl.c -+++ b/numactl.c -@@ -75,8 +75,9 @@ static struct option opts[] = { - static void usage(void) - { - fprintf(stderr, -- "usage: numactl [--all | -a] [--balancing | -b] [--interleave= | -i ]\n" -- " [--preferred= | -p ] [--preferred-many= | -P ]\n" -+ "usage: numactl [--all | -a] [--balancing | -b]\n" -+ " [--interleave= | -i ] [--weighted-interleave= | -w ]\n" -+ " [--preferred= | -p ] [--preferred-many= | -P ]\n" - " [--physcpubind= | -C ] [--cpunodebind= | -N ]\n" - " [--membind= | -m ] [--localalloc | -l] command args ...\n" - " [--localalloc | -l] command args ...\n" -@@ -90,7 +91,8 @@ static void usage(void) - " [--huge | -u] [--touch | -T] \n" - " memory policy [--dump | -d] [--dump-nodes | -D]\n" - "\n" -- "memory policy is --interleave | -i, --preferred | -p, --membind | -m, --localalloc | -l\n" -+ "memory policy is --preferred | -p, --membind | -m, --localalloc | -l,\n" -+ " --interleave | -i, --weighted-interleave | -w\n" - " is a comma delimited list of node numbers or A-B ranges or all.\n" - "Instead of a number a node can also be:\n" - " netdev:DEV the node connected to network device DEV\n" --- -2.41.0 - diff --git a/SOURCES/0006-Don-t-fail-build-when-set_mempolicy_home_node-syscal.patch b/SOURCES/0006-Don-t-fail-build-when-set_mempolicy_home_node-syscal.patch deleted file mode 100644 index 9a1d3e3..0000000 --- a/SOURCES/0006-Don-t-fail-build-when-set_mempolicy_home_node-syscal.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 87342c3b9a42aadbe1398ca8233d13ab524aa64f Mon Sep 17 00:00:00 2001 -From: Andi Kleen -Date: Thu, 16 May 2024 09:03:24 -0700 -Subject: [PATCH 6/8] Don't fail build when set_mempolicy_home_node syscall is - unknown - -Instead just warn at build and return ENOSYS. This fixes build -on architectures like arm without kernel headers installed. - -Fixes #219 - -Signed-off-by: Andi Kleen ---- - syscall.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/syscall.c b/syscall.c -index a8fe81c..21367e7 100644 ---- a/syscall.c -+++ b/syscall.c -@@ -144,7 +144,7 @@ - #if defined(__x86_64__) || defined(__aarch64__) || defined(__i386__) || defined(__powerpc__) || defined(__mips__) || defined(__s390x__) - #define __NR_set_mempolicy_home_node 450 - #else --#error "Add syscalls for your architecture or update kernel headers" -+#warning "Add syscalls for your architecture or update kernel headers" - #endif - - #endif -@@ -261,7 +261,12 @@ long WEAK move_pages(int pid, unsigned long count, - - int WEAK set_mempolicy_home_node(void *start, unsigned long len, int home_node, int flags) - { -+#ifndef __NR_set_mempolicy_home_node -+ errno = ENOSYS; -+ return -1; -+#else - return syscall(__NR_set_mempolicy_home_node, start, len, home_node, flags); -+#endif - } - - /* SLES8 glibc doesn't define those */ --- -2.41.0 - diff --git a/SOURCES/0007-numastat-eliminate-hard-coded-tables.patch b/SOURCES/0007-numastat-eliminate-hard-coded-tables.patch deleted file mode 100644 index 54eb1ea..0000000 --- a/SOURCES/0007-numastat-eliminate-hard-coded-tables.patch +++ /dev/null @@ -1,243 +0,0 @@ -From 8c454ecb0e274d254a9393346297936e67ef9e05 Mon Sep 17 00:00:00 2001 -From: Bill Gray -Date: Mon, 10 Jun 2024 16:28:55 -0400 -Subject: [PATCH 7/8] numastat: eliminate hard-coded tables - ---- - numastat.c | 139 +++++++++++++++++++++++------------------------------ - 1 file changed, 59 insertions(+), 80 deletions(-) - -diff --git a/numastat.c b/numastat.c -index 906f27f..7683f07 100644 ---- a/numastat.c -+++ b/numastat.c -@@ -84,65 +84,8 @@ static meminfo_t process_meminfo[] = { - - #define PROCESS_MEMINFO_ROWS (sizeof(process_meminfo) / sizeof(process_meminfo[0])) - --static meminfo_t numastat_meminfo[] = { -- { 0, "numa_hit", "Numa_Hit" }, -- { 1, "numa_miss", "Numa_Miss" }, -- { 2, "numa_foreign", "Numa_Foreign" }, -- { 3, "interleave_hit", "Interleave_Hit" }, -- { 4, "local_node", "Local_Node" }, -- { 5, "other_node", "Other_Node" }, --}; -- --#define NUMASTAT_MEMINFO_ROWS (sizeof(numastat_meminfo) / sizeof(numastat_meminfo[0])) -- --static meminfo_t system_meminfo[] = { -- { 0, "MemTotal", "MemTotal" }, -- { 1, "MemFree", "MemFree" }, -- { 2, "MemUsed", "MemUsed" }, -- { 3, "SwapCached", "SwapCached" }, -- { 4, "HighTotal", "HighTotal" }, -- { 5, "HighFree", "HighFree" }, -- { 6, "LowTotal", "LowTotal" }, -- { 7, "LowFree", "LowFree" }, -- { 8, "Active", "Active" }, -- { 9, "Inactive", "Inactive" }, -- { 10, "Active(anon)", "Active(anon)" }, -- { 11, "Inactive(anon)", "Inactive(anon)" }, -- { 12, "Active(file)", "Active(file)" }, -- { 13, "Inactive(file)", "Inactive(file)" }, -- { 14, "Unevictable", "Unevictable" }, -- { 15, "Mlocked", "Mlocked" }, -- { 16, "Dirty", "Dirty" }, -- { 17, "Writeback", "Writeback" }, -- { 18, "FilePages", "FilePages" }, -- { 19, "Mapped", "Mapped" }, -- { 20, "AnonPages", "AnonPages" }, -- { 21, "Shmem", "Shmem" }, -- { 22, "KernelStack", "KernelStack" }, -- { 23, "ShadowCallStack", "ShadowCallStack" }, -- { 24, "PageTables", "PageTables" }, -- { 25, "SecPageTables", "SecPageTables" }, -- { 26, "NFS_Unstable", "NFS_Unstable" }, -- { 27, "Bounce", "Bounce" }, -- { 28, "WritebackTmp", "WritebackTmp" }, -- { 29, "Slab", "Slab" }, -- { 30, "SReclaimable", "SReclaimable" }, -- { 31, "SUnreclaim", "SUnreclaim" }, -- { 32, "AnonHugePages", "AnonHugePages" }, -- { 33, "ShmemHugePages", "ShmemHugePages" }, -- { 34, "ShmemPmdMapped", "ShmemPmdMapped" }, -- { 35, "FileHugePages", "FileHugePages" }, -- { 36, "FilePmdMapped", "FilePmdMapped" }, -- { 37, "HugePages_Total", "HugePages_Total" }, -- { 38, "HugePages_Free", "HugePages_Free" }, -- { 39, "HugePages_Surp", "HugePages_Surp" }, -- { 40, "KReclaimable", "KReclaimable" } --}; -- --#define SYSTEM_MEMINFO_ROWS (sizeof(system_meminfo) / sizeof(system_meminfo[0])) -- --// To allow re-ordering the meminfo memory categories in system_meminfo and --// numastat_meminfo relative to order in /proc, etc., a simple hash index is -+// To allow re-ordering the /sys/devices/system/node/node meminfo and numastat -+// memory categories relative to order in /sys, etc., a simple hash index is - // used to look up the meminfo categories. The allocated hash table size must - // be bigger than necessary to reduce collisions (and because these specific - // hash algorithms depend on having some unused buckets. -@@ -672,7 +615,7 @@ static double huge_page_size_in_bytes = 0; - - static void display_version_and_exit(void) - { -- printf("%s\n", VERSION); -+ printf("%s version: %s: %s\n", prog_name, VERSION, __DATE__); - exit(EXIT_SUCCESS); - } - -@@ -820,9 +763,9 @@ static double update_hugepages_info(int node_ix, const char *token) - printf("cannot open %s: %s\n", fpath, strerror(errno)); - continue; - } -- unsigned long nr_pages = 0; -+ unsigned long nr_pages = 0; - if (fgets(buf, SMALL_BUF_SIZE, fs)) -- nr_pages = strtoul(buf, NULL, 10); -+ nr_pages = strtoul(buf, NULL, 10); - fclose(fs); - - total += nr_pages * hugepage_size; -@@ -835,8 +778,24 @@ static double update_hugepages_info(int node_ix, const char *token) - return total; - } - --static void show_info_from_system_file(char *file, meminfo_p meminfo, int meminfo_rows, int tok_offset) -+static void show_info_from_system_file(char *file, int tok_offset) - { -+ char fname[64]; -+ char buf[SMALL_BUF_SIZE]; -+ // Open /sys/.../node0/ -+ snprintf(fname, sizeof(fname), "/sys/devices/system/node/node0/%s", file); -+ FILE *fs = fopen(fname, "r"); -+ if (!fs) { -+ sprintf(buf, "cannot open %s", fname); -+ perror(buf); -+ exit(EXIT_FAILURE); -+ } -+ // and count the lines in the file -+ int meminfo_rows = 0; -+ while (fgets(buf, SMALL_BUF_SIZE, fs)) { -+ meminfo_rows += 1; -+ } -+ fclose(fs); - // Setup and init table - vtab_t table; - int header_rows = 2 - compatibility_mode; -@@ -844,24 +803,17 @@ static void show_info_from_system_file(char *file, meminfo_p meminfo, int meminf - // Add an extra data column for a total column - init_table(&table, header_rows, header_cols, meminfo_rows, num_nodes + 1); - int total_col_ix = header_cols + num_nodes; -- // Insert token mapping in hash table and assign left header column label for each row in table - init_hash_table(); -- for (int row = 0; (row < meminfo_rows); row++) { -- hash_insert(meminfo[row].token, meminfo[row].index); -- if (compatibility_mode) { -- string_assign(&table, (header_rows + row), 0, meminfo[row].token); -- } else { -- string_assign(&table, (header_rows + row), 0, meminfo[row].label); -- } -- } -- // printf("There are %d table hash collisions.\n", hash_collisions); - // Set left header column width and left justify it - set_col_width(&table, 0, 16); - set_col_justification(&table, 0, COL_JUSTIFY_LEFT); - // Open /sys/devices/system/node/node?/ for each node and store data - // in table. If not compatibility_mode, do approximately first third of - // this loop also for (node_ix == num_nodes) to get "Total" column header. -+ // Also, during the first iteration, insert token mapping in hash table -+ // and assign left header column label for each row in table. - for (int node_ix = 0; (node_ix < (num_nodes + (1 - compatibility_mode))); node_ix++) { -+ int row = 0; - int col = header_cols + node_ix; - // Assign header row label and horizontal line for this column... - string_assign(&table, 0, col, node_header[node_ix]); -@@ -879,9 +831,7 @@ static void show_info_from_system_file(char *file, meminfo_p meminfo, int meminf - if (node_ix == num_nodes) { - break; - } -- // Open /sys/.../node/numstast file for this node... -- char buf[SMALL_BUF_SIZE]; -- char fname[64]; -+ // Open /sys/.../node/ for this node... - snprintf(fname, sizeof(fname), "/sys/devices/system/node/node%d/%s", node_ix_map[node_ix], file); - FILE *fs = fopen(fname, "r"); - if (!fs) { -@@ -904,6 +854,34 @@ static void show_info_from_system_file(char *file, meminfo_p meminfo, int meminf - } - // example line from numastat file: "numa_miss 16463" - // example line from meminfo file: "Node 3 Inactive: 210680 kB" -+ if (node_ix == 0) { -+ char *token = strdup(tok[0 + tok_offset]); -+ if (token == NULL) { -+ perror("malloc failed line: " STRINGIFY(__LINE__)); -+ exit(EXIT_FAILURE); -+ } -+ hash_insert(token, row); -+ // printf("There are %d table hash collisions.\n", hash_collisions); -+ if ((compatibility_mode) || (!strncmp("meminfo", file, 7))) { -+ string_assign(&table, (header_rows + row), 0, token); -+ } else { -+ char *label = strdup(tok[0 + tok_offset]); -+ if (label == NULL) { -+ perror("malloc failed line: " STRINGIFY(__LINE__)); -+ exit(EXIT_FAILURE); -+ } -+ // Capitalize first letter and letters after '_' -+ char *p = label; -+ while (p) { -+ p[0] = toupper(p[0]); -+ p = strchr(p, '_'); -+ if (p) { -+ p += 1; -+ } -+ } -+ string_assign(&table, (header_rows + row), 0, label); -+ } -+ } - int index = hash_lookup(tok[0 + tok_offset]); - if (index < 0) { - printf("Token %s not in hash table.\n", tok[0 + tok_offset]); -@@ -931,10 +909,11 @@ static void show_info_from_system_file(char *file, meminfo_p meminfo, int meminf - double_assign(&table, header_rows + index, col, value); - double_addto(&table, header_rows + index, total_col_ix, value); - } -+ row += 1; - } - fclose(fs); - } -- // Crompress display column widths, if requested -+ // Compress display column widths, if requested - if (compress_display) { - for (int col = 0; (col < header_cols + num_nodes + 1); col++) { - auto_set_col_width(&table, col, 4, 16); -@@ -960,13 +939,13 @@ static void show_numastat_info(void) - if (!compatibility_mode) { - printf("\nPer-node numastat info (in MBs):\n"); - } -- show_info_from_system_file("numastat", numastat_meminfo, NUMASTAT_MEMINFO_ROWS, 0); -+ show_info_from_system_file("numastat", 0); - } - - static void show_system_info(void) - { - printf("\nPer-node system memory usage (in MBs):\n"); -- show_info_from_system_file("meminfo", system_meminfo, SYSTEM_MEMINFO_ROWS, 2); -+ show_info_from_system_file("meminfo", 2); - } - - static void show_process_info(void) -@@ -1128,7 +1107,7 @@ static void show_process_info(void) - // If showing individual tables, or we just added the last total line, - // prepare the table for display and display it... - if ((show_sub_categories) || (pid_ix + 1 == num_pids)) { -- // Crompress display column widths, if requested -+ // Compress display column widths, if requested - if (compress_display) { - for (int col = 0; (col < header_cols + num_nodes + 1); col++) { - auto_set_col_width(&table, col, 4, 16); --- -2.41.0 - diff --git a/SOURCES/0008-Update-numactl.c.patch b/SOURCES/0008-Update-numactl.c.patch deleted file mode 100644 index ea2adab..0000000 --- a/SOURCES/0008-Update-numactl.c.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 81c9a373a2f7362013d058e89716772e25ea82a0 Mon Sep 17 00:00:00 2001 -From: green-br -Date: Fri, 5 Jul 2024 11:58:54 +0100 -Subject: [PATCH 8/8] Update numactl.c - -Increase field width to align columns on larger systems. ---- - numactl.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/numactl.c b/numactl.c -index 64980f3..923be8c 100755 ---- a/numactl.c -+++ b/numactl.c -@@ -225,19 +225,19 @@ static void print_distances(int maxnode) - return; - } - printf("node distances:\n"); -- printf("node "); -+ printf("node "); - for (i = 0; i <= maxnode; i++) - if (numa_bitmask_isbitset(numa_nodes_ptr, i)) -- printf("% 3d ", i); -+ printf("% 4d ", i); - printf("\n"); - for (i = 0; i <= maxnode; i++) { - if (!numa_bitmask_isbitset(numa_nodes_ptr, i)) - continue; -- printf("% 3d: ", i); -+ printf("% 4d: ", i); - for (k = 0; k <= maxnode; k++) - if (numa_bitmask_isbitset(numa_nodes_ptr, i) && - numa_bitmask_isbitset(numa_nodes_ptr, k)) -- printf("% 3d ", numa_distance(i,k)); -+ printf("% 4d ", numa_distance(i,k)); - printf("\n"); - } - } --- -2.41.0 - diff --git a/SPECS/numactl.spec b/SPECS/numactl.spec index 38d33bc..db1df79 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.18 -Release: 3%{dist} +Version: 2.0.19 +Release: 1%{?dist} # libnuma is LGPLv2 and GPLv2 # numactl binaries are GPLv2 only License: GPL-2.0-only @@ -13,14 +13,7 @@ BuildRequires: libtool automake autoconf ExcludeArch: s390 %{arm} -Patch601: 0001-Fix-fallback-for-set_mempolicy_home_node-syscall.patch -Patch602: 0002-Add-w-and-weighted-interleave-for-weighted-interleav.patch -Patch603: 0003-numademo-Fix-the-using-of-the-uninitialized-value.patch -Patch604: 0004-numactl-Fix-RESOURCE_LEAK-in-show.patch -Patch605: 0005-numactl-Add-documentation-for-weighted-interleave.patch -Patch606: 0006-Don-t-fail-build-when-set_mempolicy_home_node-syscal.patch -Patch607: 0007-numastat-eliminate-hard-coded-tables.patch -Patch608: 0008-Update-numactl.c.patch +# Patch601: 0001-Fix-fallback-for-set_mempolicy_home_node-syscall.patch %description Simple NUMA policy support. It consists of a numactl program to run @@ -46,6 +39,8 @@ Provides development headers for numa library calls %prep %autosetup +# Fix the missing of standard autotools auxiliary files +autoreconf -i %build %configure --prefix=/usr --libdir=%{_libdir} @@ -83,7 +78,14 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man3/*.3* %changelog -* Fri Oct 25 2024 MSVSphere Packaging Team - 2.0.18-3 +* Mon Nov 18 2024 Pingfan Liu - 2.0.19-1 +- Rebase to v2.0.19 + +* Tue Oct 29 2024 Troy Dawson - 2.0.18-4 +- Bump release for October 2024 mass rebuild: + Resolves: RHEL-64018 + +* Fri Oct 25 2024 MSVSphere Packaging Team - 2.0.16-6 - Rebuilt for MSVSphere 10 * Mon Jun 24 2024 Troy Dawson - 2.0.16-6