Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eric Saint-Etienne and committed by
Arnaldo Carvalho de Melo
b18e0888 bc4da38a

+6 -7
+6 -7
tools/perf/util/map.c
··· 873 873 874 874 struct map *maps__find(struct maps *maps, u64 ip) 875 875 { 876 - struct rb_node **p, *parent = NULL; 876 + struct rb_node *p; 877 877 struct map *m; 878 878 879 879 down_read(&maps->lock); 880 880 881 - p = &maps->entries.rb_node; 882 - while (*p != NULL) { 883 - parent = *p; 884 - m = rb_entry(parent, struct map, rb_node); 881 + p = maps->entries.rb_node; 882 + while (p != NULL) { 883 + m = rb_entry(p, struct map, rb_node); 885 884 if (ip < m->start) 886 - p = &(*p)->rb_left; 885 + p = p->rb_left; 887 886 else if (ip >= m->end) 888 - p = &(*p)->rb_right; 887 + p = p->rb_right; 889 888 else 890 889 goto out; 891 890 }