All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Yury Norov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, namhyung@kernel.org,
	akpm@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org,
	acme@redhat.com, alexander.shishkin@linux.intel.com,
	peterz@infradead.org, willy@infradead.org,
	kstewart@linuxfoundation.org, pombredanne@nexb.com,
	ak@linux.intel.com, yao.jin@linux.intel.com, dsahern@gmail.com,
	andriy.shevchenko@linux.intel.com, davidcc@google.com,
	dmitry.torokhov@gmail.com, snitzer@redhat.com, hpa@zytor.com,
	ynorov@caviumnetworks.com, jolsa@redhat.com
Subject: [tip:perf/urgent] perf tools: Drop unneeded bitmap_zero() calls
Date: Sat, 18 Aug 2018 04:24:46 -0700	[thread overview]
Message-ID: <tip-3c8b81864080b710bdce446fd8401923f26fc4d4@git.kernel.org> (raw)
In-Reply-To: <20180623073502.16321-1-ynorov@caviumnetworks.com>

Commit-ID:  3c8b81864080b710bdce446fd8401923f26fc4d4
Gitweb:     https://git.kernel.org/tip/3c8b81864080b710bdce446fd8401923f26fc4d4
Author:     Yury Norov <ynorov@caviumnetworks.com>
AuthorDate: Sat, 23 Jun 2018 10:35:01 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 8 Aug 2018 15:55:44 -0300

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>
---
 tools/perf/tests/bitmap.c   | 2 --
 tools/perf/tests/mem2node.c | 2 --
 tools/perf/util/header.c    | 3 ---
 3 files changed, 7 deletions(-)

diff --git a/tools/perf/tests/bitmap.c b/tools/perf/tests/bitmap.c
index 47bedf25ba69..96e7fc1ad3f9 100644
--- a/tools/perf/tests/bitmap.c
+++ b/tools/perf/tests/bitmap.c
@@ -16,8 +16,6 @@ static unsigned long *get_bitmap(const char *str, int nbits)
 	bm = bitmap_alloc(nbits);
 
 	if (map && bm) {
-		bitmap_zero(bm, nbits);
-
 		for (i = 0; i < map->nr; i++)
 			set_bit(map->map[i], bm);
 	}
diff --git a/tools/perf/tests/mem2node.c b/tools/perf/tests/mem2node.c
index 0c3c87f86e03..9e9e4d37cc77 100644
--- a/tools/perf/tests/mem2node.c
+++ b/tools/perf/tests/mem2node.c
@@ -24,8 +24,6 @@ static unsigned long *get_bitmap(const char *str, int nbits)
 	bm = bitmap_alloc(nbits);
 
 	if (map && bm) {
-		bitmap_zero(bm, nbits);
-
 		for (i = 0; i < map->nr; i++) {
 			set_bit(map->map[i], bm);
 		}
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 5af58aac91ad..5f1af7b07b96 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -279,8 +279,6 @@ static int do_read_bitmap(struct feat_fd *ff, unsigned long **pset, u64 *psize)
 	if (!set)
 		return -ENOMEM;
 
-	bitmap_zero(set, size);
-
 	p = (u64 *) set;
 
 	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)
 		return -ENOMEM;
 	}
 
-	bitmap_zero(n->set, size);
 	n->node = idx;
 	n->size = size;
 

      parent reply	other threads:[~2018-08-18 11:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-23  7:35 [PATCH 1/2] perf: drop unneeded bitmap_zero() in util/header.c Yury Norov
2018-06-23  7:35 ` [PATCH 2/2] bitmap: sync tools with new bitmap allocation API Yury Norov
2018-06-24 21:31   ` Dmitry Torokhov
2018-06-24 22:45     ` Yury Norov
2018-07-04 15:36       ` Dmitry Torokhov
2018-07-04 17:24         ` Jiri Olsa
2018-06-25 14:12     ` Arnaldo Carvalho de Melo
2018-07-04 17:30   ` Jiri Olsa
2018-07-04 22:15   ` [PATCH v2 " Yury Norov
2018-07-25 11:22     ` Arnaldo Carvalho de Melo
2018-07-24 20:26 ` [PATCH 1/2] perf: drop unneeded bitmap_zero() in util/header.c Yury Norov
2018-07-25 11:20 ` Arnaldo Carvalho de Melo
2018-08-18 11:24 ` tip-bot for Yury Norov [this message]

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=tip-3c8b81864080b710bdce446fd8401923f26fc4d4@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davidcc@google.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pombredanne@nexb.com \
    --cc=snitzer@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=willy@infradead.org \
    --cc=yao.jin@linux.intel.com \
    --cc=ynorov@caviumnetworks.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.