diff --git a/SOURCES/0008-memhog-add-man-page.patch b/SOURCES/0008-memhog-add-man-page.patch new file mode 100644 index 0000000..c23877f --- /dev/null +++ b/SOURCES/0008-memhog-add-man-page.patch @@ -0,0 +1,88 @@ +From ffbc7a05e1777f4a2b3096483519fe5096ecc716 Mon Sep 17 00:00:00 2001 +From: Sanskriti Sharma +Date: Tue, 20 Nov 2018 10:22:06 -0500 +Subject: [PATCH] memhog: add man page + +Signed-off-by: Sanskriti Sharma +--- + 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 ++] [ ++.B size kmg ++] [ ++.B policy nodeset ++] [ ++.B \-f ++] ++.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|Repeat memset NUM times ++-f|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 + diff --git a/SOURCES/0009-numastat.8-clarify-that-information-relates-to-resid.patch b/SOURCES/0009-numastat.8-clarify-that-information-relates-to-resid.patch new file mode 100644 index 0000000..f8dcc6d --- /dev/null +++ b/SOURCES/0009-numastat.8-clarify-that-information-relates-to-resid.patch @@ -0,0 +1,33 @@ +From c2b0a955a415c104be0fa1b3118f48f726fd23ea Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +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 +Signed-off-by: Stefan Hajnoczi +--- + 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 + diff --git a/SOURCES/0010-Fix-crashes-when-using-the-touch-option.patch b/SOURCES/0010-Fix-crashes-when-using-the-touch-option.patch new file mode 100644 index 0000000..5545619 --- /dev/null +++ b/SOURCES/0010-Fix-crashes-when-using-the-touch-option.patch @@ -0,0 +1,46 @@ +From a47463a72864a76b0557468daf83741632ea4d72 Mon Sep 17 00:00:00 2001 +From: Patrick Mansfield +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 +--- + 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 + diff --git a/SPECS/numactl.spec b/SPECS/numactl.spec index ee57159..d274d03 100644 --- a/SPECS/numactl.spec +++ b/SPECS/numactl.spec @@ -1,7 +1,7 @@ Name: numactl Summary: Library for tuning for Non Uniform Memory Access machines Version: 2.0.12 -Release: 7%{?dist} +Release: 9%{?dist} # libnuma is LGPLv2 and GPLv2 # numactl binaries are GPLv2 only License: GPLv2 @@ -44,6 +44,9 @@ 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 @@ -81,6 +84,9 @@ Provides development headers for numa library calls %patch605 -p1 %patch606 -p1 %patch607 -p1 +%patch608 -p1 +%patch609 -p1 +%patch610 -p1 %build