forked from Minki/linux
perf c2c: Replace bitmap_weight() with bitmap_empty() where appropriate
Some code in builtin-c2c.c calls bitmap_weight() to check if any bit of a given bitmap is set. It's better to use bitmap_empty() in that case because bitmap_empty() stops traversing the bitmap as soon as it finds first set bit, while bitmap_weight() counts all bits unconditionally. Signed-off-by: Yury Norov <yury.norov@gmail.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Klimov <aklimov@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: David Laight <david.laight@aculab.com> Cc: Dennis Zhou <dennis@kernel.org> Cc: Emil Renner Berthing <kernel@esmil.dk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Joe Perches <joe@perches.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Link: http://lore.kernel.org/lkml/20220123183925.1052919-13-yury.norov@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
3402ae0a2e
commit
1006c5c169
@ -1080,7 +1080,7 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
|
||||
bitmap_zero(set, c2c.cpus_cnt);
|
||||
bitmap_and(set, c2c_he->cpuset, c2c.nodes[node], c2c.cpus_cnt);
|
||||
|
||||
if (!bitmap_weight(set, c2c.cpus_cnt)) {
|
||||
if (bitmap_empty(set, c2c.cpus_cnt)) {
|
||||
if (c2c.node_info == 1) {
|
||||
ret = scnprintf(hpp->buf, hpp->size, "%21s", " ");
|
||||
advance_hpp(hpp, ret);
|
||||
@ -1944,7 +1944,7 @@ static int set_nodestr(struct c2c_hist_entry *c2c_he)
|
||||
if (c2c_he->nodestr)
|
||||
return 0;
|
||||
|
||||
if (bitmap_weight(c2c_he->nodeset, c2c.nodes_cnt)) {
|
||||
if (!bitmap_empty(c2c_he->nodeset, c2c.nodes_cnt)) {
|
||||
len = bitmap_scnprintf(c2c_he->nodeset, c2c.nodes_cnt,
|
||||
buf, sizeof(buf));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user