numactl/0006-numactl.c-Fix-merging-of-neighboring-pages-policies-.patch
buque 229e261e91 numactl.c: Fix merging of neighboring pages' policies in dump_shm
In addition to checking that the policies are equal, also check that
the nodes are equal, since the policies may be the same but apply to
different nodes.

Fixes #170
2023-06-19 20:26:20 +08:00

40 lines
1.0 KiB
Diff

From 6587ed2e4b8ce6d1eb0812f89709101f2bfdd1f1 Mon Sep 17 00:00:00 2001
From: Ackerley Tng <ackerleytng@google.com>
Date: Wed, 15 Mar 2023 00:23:14 +0000
Subject: [PATCH] numactl.c: Fix merging of neighboring pages' policies in
dump_shm
In addition to checking that the policies are equal, also check that
the nodes are equal, since the policies may be the same but apply to
different nodes.
Fixes #170
Signed-off-by: buque <wuxu.wu@huawei.com>
---
shm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/shm.c b/shm.c
index 5d0d1ab..66dbea4 100644
--- a/shm.c
+++ b/shm.c
@@ -205,11 +205,12 @@ void dump_shm(void)
if (get_mempolicy(&pol, nodes->maskp, nodes->size, c+shmptr,
MPOL_F_ADDR) < 0)
err("get_mempolicy on shm");
- if (pol == prevpol)
+ if (pol == prevpol && numa_bitmask_equal(prevnodes, nodes))
continue;
if (prevpol != -1)
dumppol(start, c, prevpol, prevnodes);
- prevnodes = nodes;
+
+ copy_bitmask_to_bitmask(nodes, prevnodes);
prevpol = pol;
start = c;
}
--
2.33.0