fix the problem of some commands of memhog, migspeed and numactl failed to execute

(cherry picked from commit d81184f055d6f766d4da9f86c9714cf7c39b0f28)
This commit is contained in:
lijianglin 2022-12-16 16:43:45 +08:00 committed by openeuler-sync-bot
parent 7ee651cfe9
commit b954a3c1ba
4 changed files with 103 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From 097e362c628a8d884fab15f84872810ae0cd41d6 Mon Sep 17 00:00:00 2001
From: Chunsheng Luo <luochunsheng@huawei.com>
Date: Sat, 10 Dec 2022 17:53:36 +0800
Subject: [PATCH] libnuma: clear errno at the end of numa_init
The construct function numa_init may change errno value
before main function, which can be confuse.
Fixes: d538c645("libnuma: Query upcoming MPOL_PREFERRED_MANY support")
---
libnuma.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libnuma.c b/libnuma.c
index e1a8001..b8e5603 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -106,6 +106,9 @@ numa_init(void)
for (i = 0; i < max; i++)
nodemask_set_compat((nodemask_t *)&numa_all_nodes, i);
memset(&numa_no_nodes, 0, sizeof(numa_no_nodes));
+
+ /* clear errno */
+ errno = 0;
}
static void cleanup_node_cpu_mask_v2(void);
--
2.33.0

View File

@ -0,0 +1,36 @@
From 44f9cc0e66b12b8ed2e65734c5e7a6a9e2948189 Mon Sep 17 00:00:00 2001
From: Chunsheng Luo <luochunsheng@huawei.com>
Date: Sat, 10 Dec 2022 22:41:25 +0800
Subject: [PATCH] numactl: Fix shm verfiy for preferred policy
The following command can report verify bug:
numactl --length=4096 --shm abc -p0 --verify
when policy uses perferred, set_policy isn't set.
Fixes: 0c844d8c("Update to support multiple nodes")
---
numactl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/numactl.c b/numactl.c
index 83a741b..d3c7cea 100755
--- a/numactl.c
+++ b/numactl.c
@@ -549,6 +549,12 @@ int main(int ac, char **av)
numa_set_bind_policy(0);
if (shmfd >= 0) {
numa_tonode_memory(shmptr, shmlen, node);
+ /* Correspond to numa_set_bind_policy function */
+ if (numa_has_preferred_many()) {
+ setpolicy(MPOL_PREFERRED_MANY);
+ } else {
+ setpolicy(MPOL_PREFERRED);
+ }
} else if (c == 'p') {
if (numa_bitmask_weight(mask) != 1)
usage();
--
2.33.0

View File

@ -0,0 +1,29 @@
From afa25454aec135a40ebeafa8f25321e63822bed8 Mon Sep 17 00:00:00 2001
From: Chunsheng Luo <luochunsheng@huawei.com>
Date: Mon, 12 Dec 2022 17:10:05 +0800
Subject: [PATCH] numactl: 'numactl --length=xxx --shm xxx -px' doesn't work
When preferred is used for shm, no value is assigned to the variable node,
As a result, it does not take effect.
fixes: 5862e0e4("numactl: Simplify preferred selection")
---
numactl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/numactl.c b/numactl.c
index d3c7cea..79b323b 100755
--- a/numactl.c
+++ b/numactl.c
@@ -548,7 +548,7 @@ int main(int ac, char **av)
did_node_cpu_parse = 1;
numa_set_bind_policy(0);
if (shmfd >= 0) {
- numa_tonode_memory(shmptr, shmlen, node);
+ numa_tonode_memory(shmptr, shmlen, find_first(mask));
/* Correspond to numa_set_bind_policy function */
if (numa_has_preferred_many()) {
setpolicy(MPOL_PREFERRED_MANY);
--
2.33.0

View File

@ -1,12 +1,16 @@
Name: numactl
Version: 2.0.16
Release: 2
Release: 3
Summary: Library for tuning for Non Uniform Memory Access machines
License: GPLv2
URL: https://github.com/numactl/numactl
Source0: https://github.com/numactl/numactl/releases/download/v%{version}/numactl-%{version}.tar.gz
BuildRequires: libtool automake autoconf
Patch0001: 0001-libnuma-clear-errno-at-the-end-of-numa_init.patch
Patch0002: 0002-numactl-Fix-shm-verfiy-for-preferred-policy.patch
Patch0003: 0003-numactl-numactl-length-xxx-shm-xxx-px-doesn-t-work.patch
%description
Simple NUMA policy support. It consists of a numactl program to run other
programs with a specific NUMA policy and a libnuma shared library to set
@ -74,6 +78,9 @@ LD_LIBRARY_PATH=$(pwd)/.libs make check
%{_mandir}/man3/*.3*
%changelog
* Fri Dec 16 2022 lijianglin <lijianglin2@huawei.com> - 2.0.16-3
- fix the problem of some commands of memhog, migspeed and numactl failed to execute
* Wed Nov 9 2022 Chunsheng Luo<luochunsheng@huawei.com> - 2.0.16-2
- delete unused patches