!58 libnuma: Fix incorrect print and exit of numa_preferred/_many APIs
From: @zhangnaichuan Reviewed-by: @wangbin224 Signed-off-by: @wangbin224
This commit is contained in:
commit
0ad8c1cd08
49
0011-libnuma-Fix-unexpected-output.patch
Normal file
49
0011-libnuma-Fix-unexpected-output.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
From e763e8c86d9f10761a75c2be8510a79f25d63831 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chunsheng Luo <luochunsheng@ustc.edu>
|
||||||
|
Date: Thu, 25 Jan 2024 23:54:56 +0800
|
||||||
|
Subject: [PATCH] libnuma: Fix unexpected output
|
||||||
|
|
||||||
|
When errno is 0, numa_error(__FILE__) will print "xx: Success",
|
||||||
|
which is not as expected
|
||||||
|
|
||||||
|
Signed-off-by: Chunsheng Luo <luochunsheng@ustc.edu>
|
||||||
|
Reported-by: Ajay Panyala
|
||||||
|
|
||||||
|
Conflict: NA
|
||||||
|
Reference:https://github.com/numactl/numactl/commit/e763e8c86d9f10761a75c2be8510a79f25d63831
|
||||||
|
---
|
||||||
|
libnuma.c | 9 +++++++--
|
||||||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libnuma.c b/libnuma.c
|
||||||
|
index 8b07ab0..e898297 100644
|
||||||
|
--- a/libnuma.c
|
||||||
|
+++ b/libnuma.c
|
||||||
|
@@ -1882,8 +1882,10 @@ static struct bitmask *__numa_preferred(void)
|
||||||
|
policy != MPOL_BIND)
|
||||||
|
return bmp;
|
||||||
|
|
||||||
|
- if (numa_bitmask_weight(bmp) > 1)
|
||||||
|
+ if (numa_bitmask_weight(bmp) > 1) {
|
||||||
|
+ errno = EINVAL;
|
||||||
|
numa_error(__FILE__);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return bmp;
|
||||||
|
}
|
||||||
|
@@ -1903,8 +1905,11 @@ int numa_preferred(void)
|
||||||
|
static void __numa_set_preferred(struct bitmask *bmp)
|
||||||
|
{
|
||||||
|
int nodes = numa_bitmask_weight(bmp);
|
||||||
|
- if (nodes > 1)
|
||||||
|
+ if (nodes > 1) {
|
||||||
|
+ errno = EINVAL;
|
||||||
|
numa_error(__FILE__);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
setpol(nodes ? MPOL_PREFERRED : MPOL_LOCAL, bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
From 00dd4c32240694ae8619ed5445e4ffbc463f8eb0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chunsheng Luo <luochunsheng@ustc.edu>
|
||||||
|
Date: Fri, 26 Jan 2024 00:30:13 +0800
|
||||||
|
Subject: [PATCH] libnuma: Fix incorrect print and exit of numa_preferred/_many
|
||||||
|
APIs
|
||||||
|
|
||||||
|
Only when policy is preferred, numa_bitmask_weight will be judged,
|
||||||
|
because mbind and preferred_many support multiple nodes.
|
||||||
|
|
||||||
|
fixes: 87c6834("libnuma: Convert preferred node into a mask")
|
||||||
|
|
||||||
|
Signed-off-by: Chunsheng Luo <luochunsheng@ustc.edu>
|
||||||
|
|
||||||
|
Conflict: NA
|
||||||
|
Reference: https://github.com/numactl/numactl/commit/00dd4c32240694ae8619ed5445e4ffbc463f8eb0
|
||||||
|
---
|
||||||
|
libnuma.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/libnuma.c b/libnuma.c
|
||||||
|
index e898297..ef93558 100644
|
||||||
|
--- a/libnuma.c
|
||||||
|
+++ b/libnuma.c
|
||||||
|
@@ -1882,7 +1882,7 @@ static struct bitmask *__numa_preferred(void)
|
||||||
|
policy != MPOL_BIND)
|
||||||
|
return bmp;
|
||||||
|
|
||||||
|
- if (numa_bitmask_weight(bmp) > 1) {
|
||||||
|
+ if (policy == MPOL_PREFERRED && numa_bitmask_weight(bmp) > 1) {
|
||||||
|
errno = EINVAL;
|
||||||
|
numa_error(__FILE__);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: numactl
|
Name: numactl
|
||||||
Version: 2.0.16
|
Version: 2.0.16
|
||||||
Release: 9
|
Release: 10
|
||||||
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
|
||||||
@ -17,6 +17,8 @@ Patch0007: 0007-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch
|
|||||||
Patch0008: 0008-numastat-Update-system-hugepages-memory-info-from-sy.patch
|
Patch0008: 0008-numastat-Update-system-hugepages-memory-info-from-sy.patch
|
||||||
Patch0009: 0009-riscv64-remove-flag-latomic.patch
|
Patch0009: 0009-riscv64-remove-flag-latomic.patch
|
||||||
Patch0010: 0010-fix-fix-memory-leaks-when-run-with-H.patch
|
Patch0010: 0010-fix-fix-memory-leaks-when-run-with-H.patch
|
||||||
|
Patch0011: 0011-libnuma-Fix-unexpected-output.patch
|
||||||
|
Patch0012: 0012-libnuma-Fix-incorrect-print-and-exit-of-numa_preferr.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
|
||||||
@ -85,6 +87,9 @@ LD_LIBRARY_PATH=$(pwd)/.libs make check
|
|||||||
%{_mandir}/man3/*.3*
|
%{_mandir}/man3/*.3*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 16 2024 zhangnaichuan <zhangnaichuan@huawei.com> - 2.0.16-10
|
||||||
|
- libnuma: Fix incorrect print and exit of numa_preferred/_many APIs
|
||||||
|
|
||||||
* Tue Dec 19 2023 chenhaixiang <chenhaixiang3@huawei.com> - 2.0.16-9
|
* Tue Dec 19 2023 chenhaixiang <chenhaixiang3@huawei.com> - 2.0.16-9
|
||||||
- fix: fix memory leaks when run with -H
|
- fix: fix memory leaks when run with -H
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user