mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jakub Jelen <jakuje@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	trivial@kernel.org, Jakub Jelen <jjelen@redhat.com>,
	Jakub Jelen <jakuje@gmail.com>
Subject: [PATCH] perf bench numa: Fix assertion for nodes bitfield
Date: Sat, 19 Mar 2016 12:58:07 +0100	[thread overview]
Message-ID: <1458388687-24421-1-git-send-email-jakuje@gmail.com> (raw)

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

             reply	other threads:[~2016-03-19 11:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-19 11:58 Jakub Jelen [this message]
2016-03-21 20:49 ` Arnaldo Carvalho de Melo
2016-03-24  7:37 ` [tip:perf/urgent] " tip-bot for Jakub Jelen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458388687-24421-1-git-send-email-jakuje@gmail.com \
    --to=jakuje@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jjelen@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®