public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf bench numa: Fix assertion for nodes bitfield
@ 2016-03-19 11:58 Jakub Jelen
  2016-03-21 20:49 ` Arnaldo Carvalho de Melo
  2016-03-24  7:37 ` [tip:perf/urgent] " tip-bot for Jakub Jelen
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelen @ 2016-03-19 11:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alexander Shishkin, Arnaldo Carvalho de Melo, Ingo Molnar,
	Peter Zijlstra, trivial, Jakub Jelen, Jakub Jelen

Comparing bits and bytes in numa benchmark assertion

I hit the issue on two socket Power8 machine presenting its numa nodes as
 0,1,16,17 (according to numactl). Therefore I got error
 (and hang of parent process):

    perf: bench/numa.c:296: bind_to_memnode: Assertion `!(g->p.nr_nodes > (int)sizeof(nodemask))' failed.

This is obviously false positive. We can fit all the 18 nodes into
bitfield of 8 bytes (long on 64b architecture).

Signed-off-by: Jakub Jelen <jakuje@gmail.com>
---
Hello kernel list.
This is my first patch for kernel, so if I missed some of the guidelines,
please be patient :) I hope everything is explained in the commit message.

Thanks,
Jakub

 tools/perf/bench/numa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 870b7e6..5276b24 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -293,7 +293,7 @@ static void bind_to_memnode(int node)
 	if (node == -1)
 		return;
 
-	BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask));
+	BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
 	nodemask = 1L << node;
 
 	ret = set_mempolicy(MPOL_BIND, &nodemask, sizeof(nodemask)*8);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-24  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-19 11:58 [PATCH] perf bench numa: Fix assertion for nodes bitfield Jakub Jelen
2016-03-21 20:49 ` Arnaldo Carvalho de Melo
2016-03-24  7:37 ` [tip:perf/urgent] " tip-bot for Jakub Jelen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox