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

* Re: [PATCH] perf bench numa: Fix assertion for nodes bitfield
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-21 20:49 UTC (permalink / raw)
  To: Jakub Jelen
  Cc: linux-kernel, Alexander Shishkin, Ingo Molnar, Peter Zijlstra,
	trivial, Jakub Jelen

Em Sat, Mar 19, 2016 at 12:58:07PM +0100, Jakub Jelen escreveu:
> 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.

Very good start then, I saw no problems, you looked at existing
changesets (I guess), even capitalizing the first word after "perf bench
numa: "!  8-)

Looks fine, applied, thanks.

- Arnaldo
 
> 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	[flat|nested] 3+ messages in thread

* [tip:perf/urgent] perf bench numa: Fix assertion for nodes bitfield
  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-bot for Jakub Jelen
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Jakub Jelen @ 2016-03-24  7:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, jjelen, tglx, hpa, jakuje, linux-kernel,
	alexander.shishkin, acme, mingo

Commit-ID:  3c52b658b8e4fbbf7975932bbdc4798421dbcb15
Gitweb:     http://git.kernel.org/tip/3c52b658b8e4fbbf7975932bbdc4798421dbcb15
Author:     Jakub Jelen <jakuje@gmail.com>
AuthorDate: Sat, 19 Mar 2016 12:58:07 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 21 Mar 2016 17:46:57 -0300

perf bench numa: Fix assertion for nodes bitfield

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>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jakub Jelen <jjelen@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: trivial@kernel.org
Link: http://lkml.kernel.org/r/1458388687-24421-1-git-send-email-jakuje@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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 5049d63..7500d95 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);

^ 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