From: tip-bot for Eric Saint-Etienne <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: alexander.shishkin@linux.intel.com, jolsa@kernel.org,
tglx@linutronix.de, eric.saintetienne@gmail.com, hpa@zytor.com,
namhyung@kernel.org, mingo@kernel.org,
eric.saint.etienne@oracle.com, acme@redhat.com,
peterz@infradead.org, linux-kernel@vger.kernel.org
Subject: [tip:perf/core] perf map: Remove extra indirection from map__find()
Date: Tue, 18 Dec 2018 05:47:46 -0800 [thread overview]
Message-ID: <tip-b18e088825883bcb8dc4c4a641494049cf8ccec3@git.kernel.org> (raw)
In-Reply-To: <1542969759-24346-1-git-send-email-eric.saint.etienne@oracle.com>
Commit-ID: b18e088825883bcb8dc4c4a641494049cf8ccec3
Gitweb: https://git.kernel.org/tip/b18e088825883bcb8dc4c4a641494049cf8ccec3
Author: Eric Saint-Etienne <eric.saint.etienne@oracle.com>
AuthorDate: Fri, 23 Nov 2018 02:42:39 -0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 Dec 2018 14:53:57 -0300
perf map: Remove extra indirection from map__find()
A double pointer is used in map__find() where a single pointer is enough
because the function doesn't affect the rbtree and the rbtree is locked.
Signed-off-by: Eric Saint-Etienne <eric.saint.etienne@oracle.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Eric Saint-Etienne <eric.saintetienne@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1542969759-24346-1-git-send-email-eric.saint.etienne@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/map.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 781eed8e3265..a0d58b4d9c32 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -873,19 +873,18 @@ void maps__remove(struct maps *maps, struct map *map)
struct map *maps__find(struct maps *maps, u64 ip)
{
- struct rb_node **p, *parent = NULL;
+ struct rb_node *p;
struct map *m;
down_read(&maps->lock);
- p = &maps->entries.rb_node;
- while (*p != NULL) {
- parent = *p;
- m = rb_entry(parent, struct map, rb_node);
+ p = maps->entries.rb_node;
+ while (p != NULL) {
+ m = rb_entry(p, struct map, rb_node);
if (ip < m->start)
- p = &(*p)->rb_left;
+ p = p->rb_left;
else if (ip >= m->end)
- p = &(*p)->rb_right;
+ p = p->rb_right;
else
goto out;
}
prev parent reply other threads:[~2018-12-18 13:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 10:42 [PATCH] perf map: remove extra indirection from map__find() Eric Saint-Etienne
2018-11-23 16:14 ` Jiri Olsa
2018-11-26 18:53 ` Arnaldo Carvalho de Melo
2018-12-14 20:20 ` [tip:perf/core] perf map: Remove " tip-bot for Eric Saint-Etienne
2018-12-18 13:47 ` tip-bot for Eric Saint-Etienne [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-b18e088825883bcb8dc4c4a641494049cf8ccec3@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eric.saint.etienne@oracle.com \
--cc=eric.saintetienne@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.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=tglx@linutronix.de \
/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