Skip to content

Commit 3c8b818

Browse files
norovacmel
authored andcommitted
perf tools: Drop unneeded bitmap_zero() calls
bitmap_zero() is called after bitmap_alloc() in perf code. But bitmap_alloc() internally uses calloc() which guarantees that allocated area is zeroed. So following bitmap_zero is unneeded. Drop it. This happened because of confusing name for bitmap allocator. It should has name bitmap_zalloc instead of bitmap_alloc. This series: https://lkml.org/lkml/2018/6/18/841 introduces a new API for bitmap allocations in kernel, and functions there are named correctly. Following patch propogates the API to tools, and fixes naming issue. Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andriy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: David Carrillo-Cisneros <davidcc@google.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mike Snitzer <snitzer@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Link: http://lkml.kernel.org/r/20180623073502.16321-1-ynorov@caviumnetworks.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 704089e commit 3c8b818

3 files changed

Lines changed: 0 additions & 7 deletions

File tree

‎tools/perf/tests/bitmap.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ static unsigned long *get_bitmap(const char *str, int nbits)
1616
bm = bitmap_alloc(nbits);
1717

1818
if (map && bm) {
19-
bitmap_zero(bm, nbits);
20-
2119
for (i = 0; i < map->nr; i++)
2220
set_bit(map->map[i], bm);
2321
}

‎tools/perf/tests/mem2node.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ static unsigned long *get_bitmap(const char *str, int nbits)
2424
bm = bitmap_alloc(nbits);
2525

2626
if (map && bm) {
27-
bitmap_zero(bm, nbits);
28-
2927
for (i = 0; i < map->nr; i++) {
3028
set_bit(map->map[i], bm);
3129
}

‎tools/perf/util/header.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,6 @@ static int do_read_bitmap(struct feat_fd *ff, unsigned long **pset, u64 *psize)
279279
if (!set)
280280
return -ENOMEM;
281281

282-
bitmap_zero(set, size);
283-
284282
p = (u64 *) set;
285283

286284
for (i = 0; (u64) i < BITS_TO_U64(size); i++) {
@@ -1285,7 +1283,6 @@ static int memory_node__read(struct memory_node *n, unsigned long idx)
12851283
return -ENOMEM;
12861284
}
12871285

1288-
bitmap_zero(n->set, size);
12891286
n->node = idx;
12901287
n->size = size;
12911288

0 commit comments

Comments
 (0)