numactl/0002-numactl-Fix-shm-verfiy-for-preferred-policy.patch
lijianglin b954a3c1ba fix the problem of some commands of memhog, migspeed and numactl failed to execute
(cherry picked from commit d81184f055d6f766d4da9f86c9714cf7c39b0f28)
2022-12-16 17:27:09 +08:00

37 lines
1001 B
Diff

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