numactl/0012-libnuma-Fix-incorrect-print-and-exit-of-numa_preferr.patch

36 lines
1.0 KiB
Diff

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