Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

14 changed files with 734 additions and 68 deletions

4
.gitignore vendored
View File

@ -1 +1,3 @@
SOURCES/numactl-2.0.16.tar.gz
/numactl-[2-9]*
/.build-[2-9]*.log
/x86_64/

View File

@ -1 +0,0 @@
37ea1a333827f279e940bf0ae55d6897b331f19f SOURCES/numactl-2.0.16.tar.gz

View File

@ -0,0 +1,30 @@
From a7552a144f922031a14426b84056fa28c4cc3960 Mon Sep 17 00:00:00 2001
From: Andi Kleen <andi@firstfloor.org>
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

View File

@ -0,0 +1,149 @@
From b67fb88e77b3c200b0e300e2e0edc4f66c1d9ea5 Mon Sep 17 00:00:00 2001
From: Gregory Price <gregory.price@memverge.com>
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 <gregory.price@memverge.com>
---
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

View File

@ -0,0 +1,26 @@
From 119eb590f5f0b89611d46cdec805b22767f8a6c0 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
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 <piliu@redhat.com>
---
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

View File

@ -0,0 +1,28 @@
From ece7e227aeda655297f374f78834574badeb54c5 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
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 <piliu@redhat.com>
---
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

View File

@ -0,0 +1,80 @@
From 4bfdcc6e6111c5bf5d4ccb46f227aea80cc57159 Mon Sep 17 00:00:00 2001
From: Honggyu Kim <honggyu.kim@sk.com>
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 <honggyu.kim@sk.com>
---
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 <nodes>]\n"
- " [--preferred= | -p <node>] [--preferred-many= | -P <nodes>]\n"
+ "usage: numactl [--all | -a] [--balancing | -b]\n"
+ " [--interleave= | -i <nodes>] [--weighted-interleave= | -w <nodes>]\n"
+ " [--preferred= | -p <node>] [--preferred-many= | -P <nodes>]\n"
" [--physcpubind= | -C <cpus>] [--cpunodebind= | -N <nodes>]\n"
" [--membind= | -m <nodes>] [--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"
"<nodes> 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

View File

@ -0,0 +1,45 @@
From 87342c3b9a42aadbe1398ca8233d13ab524aa64f Mon Sep 17 00:00:00 2001
From: Andi Kleen <ak@linux.intel.com>
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 <ak@linux.intel.com>
---
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

View File

@ -0,0 +1,243 @@
From 8c454ecb0e274d254a9393346297936e67ef9e05 Mon Sep 17 00:00:00 2001
From: Bill Gray <bgray@redhat.com>
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<N> 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/<file>
+ 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?/<file> 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<N>/numstast file for this node...
- char buf[SMALL_BUF_SIZE];
- char fname[64];
+ // Open /sys/.../node<N>/<file> 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

View File

@ -0,0 +1,41 @@
From 81c9a373a2f7362013d058e89716772e25ea82a0 Mon Sep 17 00:00:00 2001
From: green-br <thomas.green@bristol.ac.uk>
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

View File

@ -1,26 +0,0 @@
From 66308a7e30a964aaad324f74c74eb5b9d75a2abd Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
Date: Mon, 12 Jun 2023 21:15:39 +0800
Subject: [PATCH] fix typo in memhog.8
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
memhog.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/memhog.8 b/memhog.8
index e28e784..3846e08 100644
--- a/memhog.8
+++ b/memhog.8
@@ -52,7 +52,7 @@ thread is running on)
# Allocate a 1G region, mmap backed by memhog.mmap file, membind to node 0, repeat test 6 times
memhog -r6 1G --membind 0 -fmemhog.mmap
.TP
-# Allocate a 1G region, iterleave across nodes 0,1,2,3, repeat test 4 times
+# Allocate a 1G region, interleave across nodes 0,1,2,3, repeat test 4 times
memhog -r4 1G --interleave 0-3
.TP
# Allocate a 1G region, (implicit) default policy, repeat test 8 times
--
2.31.1

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -1,14 +1,14 @@
Name: numactl
Summary: Library for tuning for Non Uniform Memory Access machines
Version: 2.0.16
Release: 4%{?dist}
Version: 2.0.18
Release: 2%{dist}
# libnuma is LGPLv2 and GPLv2
# numactl binaries are GPLv2 only
License: GPLv2
Group: System Environment/Base
License: LGPL-2.1-only and GPL-2.0-only
URL: https://github.com/numactl/numactl
Source0: https://github.com/numactl/numactl/releases/download/%{version}/numactl-%{version}.tar.gz
Buildroot: %{_tmppath}/%{name}-buildroot
Source0: %{url}/releases/download/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: make
BuildRequires: libtool automake autoconf
ExcludeArch: s390 %{arm}
@ -37,7 +37,15 @@ ExcludeArch: s390 %{arm}
#
# Patches 601 onward are generic patches
#
Patch601: 0001-fix-typo-in-memhog.8.patch
#Patch601: 0001-fix-typo-in-memhog.8.patch
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
@ -48,8 +56,7 @@ other programs with a specific NUMA policy.
%package libs
Summary: libnuma libraries
# There is a tiny bit of GPLv2 code in libnuma.c
License: LGPLv2 and GPLv2
Group: System Environment/Libraries
License: LGPL-2.1-only and GPL-2.0-only
%description libs
numactl-libs provides libnuma, a library to do allocations with
@ -57,36 +64,30 @@ NUMA policy in applications.
%package devel
Summary: Development package for building Applications that use numa
Group: System Environment/Libraries
Requires: %{name}-libs = %{version}-%{release}
License: LGPLv2 and GPLv2
License: LGPL-2.1-only and GPL-2.0-only
%description devel
Provides development headers for numa library calls
%prep
%setup -q -n %{name}-%{version}
#patch
%patch601 -p1
%autosetup
%build
aclocal && automake
%configure --prefix=/usr --libdir=%{_libdir}
make clean
make CFLAGS="$RPM_OPT_FLAGS -I."
# Using recipe to fix rpaths, from here:
# https://fedoraproject.org/wiki/RPath_Packaging_Draft#Removing_Rpath
sed -i -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build
%install
rm -rf $RPM_BUILD_ROOT
%make_install
make DESTDIR=$RPM_BUILD_ROOT install
%post -p /sbin/ldconfig
%post libs -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%ldconfig_scriptlets
%ldconfig_scriptlets libs
%files
%doc README.md
@ -105,39 +106,78 @@ make DESTDIR=$RPM_BUILD_ROOT install
%files devel
%{_libdir}/libnuma.so
%{_libdir}/pkgconfig/numa.pc
%exclude %{_libdir}/libnuma.a
%exclude %{_libdir}/libnuma.la
%{_libdir}/pkgconfig/numa.pc
%{_includedir}/numa.h
%{_includedir}/numaif.h
%{_includedir}/numacompat1.h
%{_mandir}/man3/*.3*
%changelog
* Tue Jul 30 2024 Pingfan Liu <piliu@redhat.com> - 2.0.18-1
- rebase to v2.0.18
* Thu Sep 14 2023 Pingfan Liu <piliu@redhat.com> - 2.0.16-2
- fix typo in memhog.8
- Remove contained patches
* Wed May 12 2021 Pingfan Liu <piliu@redhat.com> - 2.0.12-13
* Wed Nov 23 2022 Pingfan Liu <piliu@redhat.com> - 2.0.14-9
- Dummy release to get s390x binary in errata
* Tue Jan 4 2022 Pingfan Liu <piliu@redhat.com> - 2.0.14-8
- For GA release
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.14-7
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue Jul 6 2021 Pingfan Liu <piliu@redhat.com> - 2.0.14-6
- fix covscan complain
* Mon May 24 2021 Pingfan Liu <piliu@redhat.com> - 2.0.14-5
- libnuma: make numa_police_memory() free of race
* Sat May 9 2020 Pingfan Liu <piliu@redhat.com> - 2.0.12-11
- Update manpage description of --localalloc option
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.14-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Fri Mar 13 2020 Pingfan Liu <piliu@redhat.com> - 2.0.12-10
- memhog : add man page
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.14-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Apr 1 2019 Pingfan Liu <piliu@redhat.com> - 2.0.12-3
- add gating test cases
* Wed Nov 11 2020 Florian Weimer <fweimer@redhat.com> - 2.0.14-2
- Trigger rebuild to avoid DT_INIT/DT_FINI with zero values
* Mon Nov 26 2018 Pingfan Liu <piliu@redhat.com> - 2.0.12-2
- Fix: Add ShmemHugePages and ShmemPmdMapped to system_meminfo[]
* Thu Sep 17 2020 Filipe Brandenburger <filbranden@gmail.com> - 2.0.14-1
- Upgrade to 2.0.14
- Re-enabled LTO, now that upstream has been fixed to support it.
* Mon Nov 5 2018 Pingfan Liu <piliu@redhat.com> - 2.0.12-1
- Rebase to 2.0.12
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.12-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Aug 10 2018 Lianbo Jiang <lijiang@redhat.com> - 2.0.11-8%{dist}
- Fix compilation error (bz1611734)
* Wed Jul 01 2020 Jeff Law <law@redhat.com> - 2.0.12-5
- Disable LTO
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.12-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jul 25 2018 Filipe Brandenburger <filbranden@gmail.com> - 2.0.12-1
- Rebased to version 2.0.12
* Wed Jul 25 2018 Filipe Brandenburger <filbranden@gmail.com>
- Fix check-rpaths warning about including /usr/lib64 in RPATH of the binaries.
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Sat Mar 24 2018 Richard W.M. Jones <rjones@redhat.com> - 2.0.11-9%{dist}
- Fix major/minor macros on glibc 2.27.
- Update config.{guess,sub} with versions which understand riscv64.
- Remove obsolete Buildroot tag.
* Sat Feb 24 2018 Florian Weimer <fweimer@redhat.com> - 2.0.11-8%{dist}
- Use LDFLAGS from redhat-rpm-config

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (numactl-2.0.16.tar.gz) = 6e17724567c363a08994fe7f5569b6ec62bd1ae608244945fddcb2d6a212b08140340f0d862595ba4016fcba95193e851cb286798f685d314b4c72687af6d879
SHA512 (numactl-2.0.18.tar.gz) = 17abe7a3744065edb5ec1e27135873629031c509313809ca99e0d9254f7a5cb00cce5b32173e811e9b9d7cb407aabdcbe3c6be6e3b094ad3e7d696a154b7f1ec