import numactl-2.0.12-13.el8

c8 imports/c8/numactl-2.0.12-13.el8
CentOS Sources 3 years ago committed by MSVSphere Packaging Team
commit c02394f9bb

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/numactl-2.0.12.tar.gz

@ -0,0 +1 @@
8576ef894d2c4d25adddd792593bcd92e711d86f SOURCES/numactl-2.0.12.tar.gz

@ -0,0 +1,32 @@
From cd7c78e77dc43fff5dbe2763f1ac83a8b4a6b1c7 Mon Sep 17 00:00:00 2001
From: Harish <harish@linux.vnet.ibm.com>
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 <harish@linux.vnet.ibm.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
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

@ -0,0 +1,63 @@
From 2b190afdbbff875e519e4ae45390bdde11e8e190 Mon Sep 17 00:00:00 2001
From: Harish <harish@linux.vnet.ibm.com>
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 <harish@linux.vnet.ibm.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
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

@ -0,0 +1,50 @@
From c465ca7ca41aa03e755ed71fa0281c620b0d8dc0 Mon Sep 17 00:00:00 2001
From: Harish <harish@linux.vnet.ibm.com>
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 <harish@linux.vnet.ibm.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
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

@ -0,0 +1,122 @@
From 09d294e8d83151fb76a7fc741bc6251c0b171e25 Mon Sep 17 00:00:00 2001
From: Harish <harish@linux.vnet.ibm.com>
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 <harish@linux.vnet.ibm.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
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

@ -0,0 +1,48 @@
From d1bc1653b3f86b8951b876946a94db681764fa2a Mon Sep 17 00:00:00 2001
From: Filipe Brandenburger <filbranden@google.com>
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 <piliu@redhat.com>
---
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

@ -0,0 +1,83 @@
From bad479d2fe1075cfc83ffbd4ad39bcc6e800e7ca Mon Sep 17 00:00:00 2001
From: Harish <harish@linux.vnet.ibm.com>
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 <harish@linux.vnet.ibm.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
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

@ -0,0 +1,39 @@
From a8f5ed65b745f96f5e5af72bace8e7c63b96fd4e Mon Sep 17 00:00:00 2001
From: Sanskriti Sharma <sansharm@redhat.com>
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 <sansharm@redhat.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
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

@ -0,0 +1,88 @@
From ffbc7a05e1777f4a2b3096483519fe5096ecc716 Mon Sep 17 00:00:00 2001
From: Sanskriti Sharma <sansharm@redhat.com>
Date: Tue, 20 Nov 2018 10:22:06 -0500
Subject: [PATCH] memhog: add man page
Signed-off-by: Sanskriti Sharma <sansharm@redhat.com>
---
memhog.8 | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 memhog.8
diff --git a/memhog.8 b/memhog.8
new file mode 100644
index 0000000..e28e784
--- /dev/null
+++ b/memhog.8
@@ -0,0 +1,68 @@
+.TH MEMHOG 8 "2003,2004" "SuSE Labs" "Linux Administrator's Manual"
+.SH NAME
+memhog \- Allocates memory with policy for testing
+.SH SYNOPSIS
+.B memhog
+[
+.B \-r<NUM>
+] [
+.B size kmg
+] [
+.B policy nodeset
+] [
+.B \-f<filename>
+]
+.SH DESCRIPTION
+.B memhog
+mmaps a memory region for a given size and sets the numa policy (if specified).
+It then updates the memory region for the given number of iterations using memset.
+.TS
+tab(|);
+l l.
+-r<num>|Repeat memset NUM times
+-f<file>|Open file for mmap backing
+-H|Disable transparent hugepages
+-size|Allocation size in bytes, may have case-insensitive order
+|suffix (G=gigabyte, M=megabyte, K=kilobyte)
+.TE
+
+Supported numa-policies:
+.TP
+.B interleave
+Memory will be allocated using round robin on nodes. When
+memory cannot be allocated on the current interleave, target fall back
+to other nodes. Multiple nodes may be specified.
+.TP
+.B membind
+Only allocate memory from nodes. Allocation will fail
+when there is not enough memory available on these nodes. Multiple
+nodes may be specified.
+.TP
+.B preferred
+Preferably allocate memory on node, but if memory cannot be
+allocated there fall back to other nodes. This option takes only a
+single node number.
+.TP
+.B default
+Memory will be allocated on the local node (the node the
+thread is running on)
+
+.SH EXAMPLES
+.TP
+# 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
+memhog -r4 1G --interleave 0-3
+.TP
+# Allocate a 1G region, (implicit) default policy, repeat test 8 times
+memhog -r8 1G
+
+.SH AUTHORS
+Andi Kleen (ak@suse.de)
+
+.SH LICENSE
+GPL v2
+
+.SH SEE ALSO
+.I mmap(2), memset(3), numactl(8), numastat(8)
--
2.7.5

@ -0,0 +1,33 @@
From c2b0a955a415c104be0fa1b3118f48f726fd23ea Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 9 Jul 2019 16:10:46 +0200
Subject: [PATCH] numastat.8: clarify that information relates to resident
pages
The man page gives no hint about whether memory usage information
relates to resident pages or virtual memory. The answer may not be
obvious to the user, so explicitly mention that only resident pages are
counted.
Suggested-by: Daniele Palumbo <daniele@retaggio.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
numastat.8 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/numastat.8 b/numastat.8
index 4dcddf3..7fbcab2 100644
--- a/numastat.8
+++ b/numastat.8
@@ -54,6 +54,8 @@ Any supplied options or arguments with the \fBnumastat\fP command will
significantly change both the content and the format of the display. Specified
options will cause display units to change to megabytes of memory, and will
change other specific behaviors of \fBnumastat\fP as described below.
+.LP
+Memory usage information reflects the resident pages on the system.
.SH "OPTIONS"
.LP
.TP
--
2.7.5

@ -0,0 +1,46 @@
From a47463a72864a76b0557468daf83741632ea4d72 Mon Sep 17 00:00:00 2001
From: Patrick Mansfield <patrick.mansfield@cpacketnetworks.com>
Date: Mon, 30 Sep 2019 15:59:53 -0700
Subject: [PATCH] Fix crashes when using the "--touch" option.
Fix memory to be mapped read/write, so that the "touch" option can write to it.
Signed-off-by: Patrick Mansfield <patrick.mansfield@cpacketnetworks.com>
---
shm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/shm.c b/shm.c
index 260eeff..fb592ed 100644
--- a/shm.c
+++ b/shm.c
@@ -119,7 +119,7 @@ void attach_sysvshm(char *name, char *opt)
shmlen = s.shm_segsz;
}
- shmptr = shmat(shmfd, NULL, SHM_RDONLY);
+ shmptr = shmat(shmfd, NULL, 0);
if (shmptr == (void*)-1)
err("shmat");
shmptr += shmoffset;
@@ -134,7 +134,7 @@ void attach_shared(char *name, char *opt)
{
struct stat64 st;
- shmfd = open(name, O_RDONLY);
+ shmfd = open(name, O_RDWR);
if (shmfd < 0) {
errno = 0;
if (shmlen == 0)
@@ -160,7 +160,7 @@ void attach_shared(char *name, char *opt)
/* RED-PEN For shmlen > address space may need to map in pieces.
Left for some poor 32bit soul. */
- shmptr = mmap64(NULL, shmlen, PROT_READ, MAP_SHARED, shmfd, shmoffset);
+ shmptr = mmap64(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset);
if (shmptr == (char*)-1)
err("shm mmap");
--
2.7.5

@ -0,0 +1,26 @@
From 6a41846f3191afe48144481bbfa2fd4edafdc8d5 Mon Sep 17 00:00:00 2001
From: Sanskriti Sharma <sansharm@redhat.com>
Date: Wed, 21 Nov 2018 10:28:44 -0500
Subject: [PATCH] Added memhog.8 to Makefile.am Signed-off-by: Sanskriti Sharma
<sansharm@redhat.com>
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 1c4266d..ab61d42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,7 +12,7 @@ include_HEADERS = numa.h numacompat1.h numaif.h
noinst_HEADERS = numaint.h util.h
-dist_man_MANS = move_pages.2 numa.3 numactl.8 numastat.8 migratepages.8 migspeed.8
+dist_man_MANS = move_pages.2 numa.3 numactl.8 numastat.8 migratepages.8 migspeed.8 memhog.8
EXTRA_DIST = README.md INSTALL.md
--
2.7.5

@ -0,0 +1,26 @@
From 26fba7199c365b55e72e054bb2adba097ce04924 Mon Sep 17 00:00:00 2001
From: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Date: Wed, 8 Jan 2020 14:39:01 +0530
Subject: [PATCH] Update manpage description of --localalloc option
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
---
numactl.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/numactl.8 b/numactl.8
index 7a001c0..f3bb22b 100644
--- a/numactl.8
+++ b/numactl.8
@@ -159,7 +159,7 @@ A !N-N notation indicates the inverse of N-N, in other words all cpus
except N-N. If used with + notation, specify !+N-N.
.TP
.B \-\-localalloc, \-l
-Always allocate on the current node.
+Try to allocate on the current node of the process, but if memory cannot be allocated there fall back to other nodes.
.TP
.B \-\-preferred=node
Preferably allocate memory on
--
2.7.5

@ -0,0 +1,35 @@
From 93867c59b0bb29470873a427dc7f06ebaf305221 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
Date: Mon, 29 Mar 2021 17:33:06 +0800
Subject: [PATCH] libnuma: make numa_police_memory() free of race
When numa_police_memory() read-write to memory, it can risk the race of
another thread write to the same area.
Using atomic function to protect the read-write operation
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
libnuma.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libnuma.c b/libnuma.c
index f073c50..7b8290c 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -864,8 +864,10 @@ void numa_police_memory(void *mem, size_t size)
{
int pagesize = numa_pagesize_int();
unsigned long i;
- for (i = 0; i < size; i += pagesize)
- ((volatile char*)mem)[i] = ((volatile char*)mem)[i];
+ char *p = mem;
+ for (i = 0; i < size; i += pagesize, p += pagesize)
+ __atomic_and_fetch(p, 0xff, __ATOMIC_RELAXED);
+
}
make_internal_alias(numa_police_memory);
--
2.29.2

@ -0,0 +1,375 @@
Name: numactl
Summary: Library for tuning for Non Uniform Memory Access machines
Version: 2.0.12
Release: 13%{?dist}
# libnuma is LGPLv2 and GPLv2
# numactl binaries are GPLv2 only
License: GPLv2
Group: System Environment/Base
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 %{arm}
#START INSERT
#
# Patches 0 through 100 are meant for x86
#
#
# Patches 101 through 200 are meant for x86_64
#
#
# Patches 301 through 400 are meant for ppc64le
#
#
# Patches 401 through 500 are meant for s390x
#
#
# Patches 501 through 600 are meant for aarch64
#
#
# Patches 601 onward are generic patches
#
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
Patch608 :0008-memhog-add-man-page.patch
Patch609: 0009-numastat.8-clarify-that-information-relates-to-resid.patch
Patch610: 0010-Fix-crashes-when-using-the-touch-option.patch
Patch611: 0011-Added-memhog.8-to-Makefile.am.patch
Patch612: 0012-Update-manpage-description-of-localalloc-option.patch
Patch613: 0013-libnuma-make-numa_police_memory-free-of-race.patch
%description
Simple NUMA policy support. It consists of a numactl program to run
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
%description libs
numactl-libs provides libnuma, a library to do allocations with
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
%description devel
Provides development headers for numa library calls
%prep
%setup -q -n %{name}-%{version}
#patch
%patch601 -p1
%patch602 -p1
%patch603 -p1
%patch604 -p1
%patch605 -p1
%patch606 -p1
%patch607 -p1
%patch608 -p1
%patch609 -p1
%patch610 -p1
%patch611 -p1
%patch612 -p1
%patch613 -p1
%build
aclocal && automake
%configure --prefix=/usr --libdir=%{_libdir}
make clean
make CFLAGS="$RPM_OPT_FLAGS -I."
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%post -p /sbin/ldconfig
%post libs -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%files
%doc README.md
%{_bindir}/numactl
%{_bindir}/numademo
%{_bindir}/numastat
%{_bindir}/memhog
%{_bindir}/migspeed
%{_bindir}/migratepages
%{_mandir}/man8/*.8*
%exclude %{_mandir}/man2/*.2*
%files libs
%{_libdir}/libnuma.so.1.0.0
%{_libdir}/libnuma.so.1
%files devel
%{_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
* Wed May 12 2021 Pingfan Liu <piliu@redhat.com> - 2.0.12-13
- 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 Mar 13 2020 Pingfan Liu <piliu@redhat.com> - 2.0.12-10
- memhog : add man page
* Mon Apr 1 2019 Pingfan Liu <piliu@redhat.com> - 2.0.12-3
- add gating test cases
* Mon Nov 26 2018 Pingfan Liu <piliu@redhat.com> - 2.0.12-2
- Fix: Add ShmemHugePages and ShmemPmdMapped to system_meminfo[]
* Mon Nov 5 2018 Pingfan Liu <piliu@redhat.com> - 2.0.12-1
- Rebase to 2.0.12
* Fri Aug 10 2018 Lianbo Jiang <lijiang@redhat.com> - 2.0.11-8%{dist}
- Fix compilation error (bz1611734)
* Sat Feb 24 2018 Florian Weimer <fweimer@redhat.com> - 2.0.11-8%{dist}
- Use LDFLAGS from redhat-rpm-config
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.11-7
- Escape macros in %%changelog
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Feb 06 2017 Petr Holasek <holasekp@gmail.com> - 2.0.11-3
- s390x arch enabled (bz1419064)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Mon Dec 14 2015 Petr Holasek <pholasek@redhat.com> - 2.0.11-1
- Rebased to version 2.0.11 (bz1290941)
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Oct 13 2014 Petr Holasek <pholasek@redhat.com> 2.0.10-2
- Fixing package conflict with man-pages (bz1151552)
* Wed Oct 08 2014 Petr Holasek <pholasek@redhat.com> 2.0.10-1
- Rebased to version 2.0.10 (bz1150511)
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Thu Jul 31 2014 Petr Holasek <pholasek@redhat.com> 2.0.9-3
- fixed segfault on non-NUMA systems (bz1080421)
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Oct 09 2013 Petr Holasek <pholasek@redhat.com> 2.0.9-1
- rebased to version 2.0.9
* Fri Aug 02 2013 Karsten Hopp <karsten@redhat.com> 2.0.8-4
- rebuild in F20 to fix some dependency issues on PPC
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Tue Jan 22 2013 Petr Holasek <pholasek@redhat.com> - 2.0.8-3
- deleted empty numastat file
* Thu Nov 1 2012 Tom Callaway <spot@fedoraproject.org> - 2.0.8-2
- fix license issues
* Fri Oct 26 2012 Petr Holasek <pholasek@redhat.com> - 2.0.8-1
- Rebased to version 2.0.8
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.7-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sat May 19 2012 Petr Holasek <pholasek@redhat.com> - 2.0.7-6
- numademo segfault fix (bz823125, bz823127)
* Sun Apr 15 2012 Petr Holasek <pholasek@redhat.com> - 2.0.7-5
- Library splitted out of numactl package to numactl-libs
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Jan 02 2012 Anton Arapov <anton@redhat.com> - 2.0.7-3
- Include missing manpages
* Sat Jun 18 2011 Peter Robinson <pbrobinson@gmail.com> - 2.0.7-2
- Exclude ARM platforms
* Fri Apr 15 2011 Anton Arapov <anton@redhat.com> - 2.0.7-1
- Update to latest upstream stable version (bz 696703)
* Tue Mar 22 2011 Anton Arapov <anton@redhat.com> - 2.0.6-2
- Better manpages (bz 673613)
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Tue Jan 04 2011 Neil Horman <nhorman@redhat.com> - 2.0.6-1
- Update to latest upstream stable version (bz 666379)
* Mon Oct 18 2010 Neil Horman <nhorman@redhat.com> - 2.0.5-1
- Update to latest stable upstream source
* Mon Feb 15 2010 Neil Horman <nhorman@redhat.com> - 2.0.3-8
- Remove static libs from numactl (bz 556088)
* Mon Aug 10 2009 Neil Horman <nhorman@redhat.com> - 2.0.3-7
- Add destructor to libnuma.so to free allocated memory (bz 516227)
* Mon Aug 10 2009 Neil Horman <nhorman@redhat.com> - 2.0.3-6
- Fix obo in nodes_allowed_list strncpy (bz 516223)
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Fri Jun 26 2009 Neil Horman <nhorman@redhat.com>
- Update to full 2.0.3 version (bz 506795)
* Wed Jun 17 2009 Neil Horman <nhorman@redhat.com>
- Fix silly libnuma warnings again (bz 499633)
* Fri May 08 2009 Neil Horman <nhorman@redhat.com>
- Update to 2.0.3-rc3 (bz 499633)
* Wed Mar 25 2009 Mark McLoughlin <markmc@redhat.com> - 2.0.2-4
- Remove warning from libnuma (bz 484552)
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Mon Sep 29 2008 Neil Horman <nhorman@redhat.com> - 2.0.2-2
- Fix build break due to register selection in asm
* Mon Sep 29 2008 Neil Horman <nhorman@redhat.com> - 2.0.2-1
- Update rawhide to version 2.0.2 of numactl
* Fri Apr 25 2008 Neil Horman <nhorman@redhat.com> - 1.0.2-6
- Fix buffer size passing and arg sanity check for physcpubind (bz 442521)
* Fri Mar 14 2008 Neil Horman <nhorman@redhat.com> - 1.0.2-5
- Fixing spec file to actually apply alpha patch :)
* Fri Mar 14 2008 Neil Horman <nhorman@redhat.com> - 1.0.2-4
- Add alpha syscalls (bz 396361)
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.0.2-3
- Autorebuild for GCC 4.3
* Thu Dec 20 2007 Neil Horman <nhorman@redhat.com> - 1.0.2-1
- Update numactl to fix get_mempolicy signature (bz 418551)
* Fri Dec 14 2007 Neil Horman <nhorman@redhat.com> - 1.0.2-1
- Update numactl to latest version (bz 425281)
* Tue Aug 07 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-4
- Fixing some remaining merge review issues (bz 226207)
* Fri Aug 03 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-3
- fixing up merge review (bz 226207)
* Fri Jan 12 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-2
- Properly fixed bz 221982
- Updated revision string to include %%{dist}
* Thu Jan 11 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-1.38
- Fixed -devel to depend on base package so libnuma.so resolves
* Thu Sep 21 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.36
- adding nodebind patch for bz 207404
* Fri Aug 25 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.35
- moving over libnuma.so to -devel package as well
* Fri Aug 25 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.34
- split out headers/devel man pages to a devel subpackage
* Tue Aug 15 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.32
- add patch for broken cpu/nodebind output (bz 201906)
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 0.9.8-1.31
- rebuild
* Tue Jun 13 2006 Neil Horman <nhorman@redhat.com>
- Rebased numactl to version 0.9.8 for FC6/RHEL5
* Wed Apr 26 2006 Neil Horman <nhorman@redhat.com>
- Added patches for 64 bit overflows and cpu mask problem
* Fri Mar 10 2006 Bill Nottingham <notting@redhat.com>
- rebuild for ppc TLS issue (#184446)
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 0.6.4-1.25.2
- bump again for double-long bug on ppc(64)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com>
- rebuilt for new gcc4.1 snapshot and glibc changes
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Thu Jul 7 2005 Dave Jones <davej@redhat.com>
- numactl doesn't own the manpage dirs. (#161547)
* Tue Mar 1 2005 Dave Jones <davej@redhat.com>
- Rebuild for gcc4
* Tue Feb 8 2005 Dave Jones <davej@redhat.com>
- rebuild with -D_FORTIFY_SOURCE=2
* Wed Nov 10 2004 David Woodhouse <dwmw2@redhat.com>
- Fix build on x86_64
* Thu Oct 21 2004 David Woodhouse <dwmw2@redhat.com>
- Add PPC support
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Sat Jun 05 2004 Warren Togami <wtogami@redhat.com>
- spec cleanup
* Sat Jun 05 2004 Arjan van de Ven <arjanv@redhat.com>
- initial packaging
Loading…
Cancel
Save