提交 b18e0888 编写于 作者: E Eric Saint-Etienne 提交者: Arnaldo Carvalho de Melo

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: NEric Saint-Etienne <eric.saint.etienne@oracle.com>
Acked-by: NJiri 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 bc4da38a
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册