fix wrong nodemask_sz when CONFIG_NODES_SHIFT is less than 5
This commit is contained in:
parent
6e8a1e1dc1
commit
214d7b07a5
@ -0,0 +1,61 @@
|
|||||||
|
From eeb3d396ee5401114bf0d486d200dffb03f54ac5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chunsheng Luo <luochunsheng@huawei.com>
|
||||||
|
Date: Tue, 15 Nov 2022 15:21:31 +0800
|
||||||
|
Subject: [PATCH] fix wrong nodemask_sz when CONFIG_NODES_SHIFT is less than 5
|
||||||
|
|
||||||
|
Signed-off-by: buque <wuxu.wu@huawei.com>
|
||||||
|
---
|
||||||
|
libnuma.c | 22 ++++++++++++++--------
|
||||||
|
1 file changed, 14 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libnuma.c b/libnuma.c
|
||||||
|
index b8e5603..896e995 100644
|
||||||
|
--- a/libnuma.c
|
||||||
|
+++ b/libnuma.c
|
||||||
|
@@ -370,13 +370,11 @@ set_configured_nodes(void)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- * Convert the string length of an ascii hex mask to the number
|
||||||
|
- * of bits represented by that mask.
|
||||||
|
- */
|
||||||
|
-static int s2nbits(const char *s)
|
||||||
|
+static inline int is_digit(char s)
|
||||||
|
{
|
||||||
|
- return strlen(s) * 32 / 9;
|
||||||
|
+ return (s >= '0' && s <= '9')
|
||||||
|
+ || (s >= 'a' && s <= 'f')
|
||||||
|
+ || (s >= 'A' && s <= 'F');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Is string 'pre' a prefix of string 's'? */
|
||||||
|
@@ -398,6 +396,8 @@ set_nodemask_size(void)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char *buf = NULL;
|
||||||
|
+ char *tmp_buf = NULL;
|
||||||
|
+ int digit_len = 0;
|
||||||
|
size_t bufsize = 0;
|
||||||
|
|
||||||
|
if ((fp = fopen(mask_size_file, "r")) == NULL)
|
||||||
|
@@ -405,8 +405,14 @@ set_nodemask_size(void)
|
||||||
|
|
||||||
|
while (getline(&buf, &bufsize, fp) > 0) {
|
||||||
|
if (strprefix(buf, nodemask_prefix)) {
|
||||||
|
- nodemask_sz = s2nbits(buf + strlen(nodemask_prefix));
|
||||||
|
- break;
|
||||||
|
+ tmp_buf = buf;
|
||||||
|
+ tmp_buf += strlen(nodemask_prefix);
|
||||||
|
+ while (*tmp_buf != '\n' && *tmp_buf != '\0') {
|
||||||
|
+ if (is_digit(*tmp_buf))
|
||||||
|
+ digit_len++;
|
||||||
|
+ tmp_buf++;
|
||||||
|
+ }
|
||||||
|
+ nodemask_sz = digit_len * 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(buf);
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: numactl
|
Name: numactl
|
||||||
Version: 2.0.16
|
Version: 2.0.16
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: Library for tuning for Non Uniform Memory Access machines
|
Summary: Library for tuning for Non Uniform Memory Access machines
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: https://github.com/numactl/numactl
|
URL: https://github.com/numactl/numactl
|
||||||
@ -10,6 +10,7 @@ BuildRequires: libtool automake autoconf
|
|||||||
Patch0001: 0001-libnuma-clear-errno-at-the-end-of-numa_init.patch
|
Patch0001: 0001-libnuma-clear-errno-at-the-end-of-numa_init.patch
|
||||||
Patch0002: 0002-numactl-Fix-shm-verfiy-for-preferred-policy.patch
|
Patch0002: 0002-numactl-Fix-shm-verfiy-for-preferred-policy.patch
|
||||||
Patch0003: 0003-numactl-numactl-length-xxx-shm-xxx-px-doesn-t-work.patch
|
Patch0003: 0003-numactl-numactl-length-xxx-shm-xxx-px-doesn-t-work.patch
|
||||||
|
Patch0004: 0004-fix-wrong-nodemask_sz-when-CONFIG_NODES_SHIFT-is-les.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Simple NUMA policy support. It consists of a numactl program to run other
|
Simple NUMA policy support. It consists of a numactl program to run other
|
||||||
@ -78,6 +79,9 @@ LD_LIBRARY_PATH=$(pwd)/.libs make check
|
|||||||
%{_mandir}/man3/*.3*
|
%{_mandir}/man3/*.3*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 19 2023 wuxu <wuxu.wu@huawei.com> - 2.0.16-4
|
||||||
|
- fix wrong nodemask_sz when CONFIG_NODES_SHIFT is less than 5
|
||||||
|
|
||||||
* Fri Dec 16 2022 lijianglin <lijianglin2@huawei.com> - 2.0.16-3
|
* 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
|
- fix the problem of some commands of memhog, migspeed and numactl failed to execute
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user