[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-97dfc3423ca701212802a02994d1ec3e688f4891@git.kernel.org>
Date: Fri, 14 Dec 2018 12:20:41 -0800
From: tip-bot for Eric Saint-Etienne <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: alexander.shishkin@...ux.intel.com, linux-kernel@...r.kernel.org,
namhyung@...nel.org, peterz@...radead.org, tglx@...utronix.de,
jolsa@...nel.org, eric.saint.etienne@...cle.com,
eric.saintetienne@...il.com, hpa@...or.com, acme@...hat.com,
mingo@...nel.org
Subject: [tip:perf/core] perf map: Remove extra indirection from map__find()
Commit-ID: 97dfc3423ca701212802a02994d1ec3e688f4891
Gitweb: https://git.kernel.org/tip/97dfc3423ca701212802a02994d1ec3e688f4891
Author: Eric Saint-Etienne <eric.saint.etienne@...cle.com>
AuthorDate: Fri, 23 Nov 2018 02:42:39 -0800
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 29 Nov 2018 20:42:46 -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@...cle.com>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Eric Saint-Etienne <eric.saintetienne@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.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@...hat.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;
}
Powered by blists - more mailing lists