perf stat: Fix saved values rbtree lookup
The stat shadow saved values rbtree is indexed by a pointer. Fix the comparison function: - We cannot return a pointer delta as an int because that loses bits on 64bit. - Doing pointer arithmetic on the struct pointer only works if the objects are spaced by the multiple of the object size, which is not guaranteed for individual malloc'ed object Replace it with a proper comparison. This fixes various problems with values not being found. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/20170724234015.5165-4-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
3c22ba5243
commit
5e97665f91
@ -70,7 +70,11 @@ static int saved_value_cmp(struct rb_node *rb_node, const void *entry)
|
||||
return a->ctx - b->ctx;
|
||||
if (a->cpu != b->cpu)
|
||||
return a->cpu - b->cpu;
|
||||
return a->evsel - b->evsel;
|
||||
if (a->evsel == b->evsel)
|
||||
return 0;
|
||||
if ((char *)a->evsel < (char *)b->evsel)
|
||||
return -1;
|
||||
return +1;
|
||||
}
|
||||
|
||||
static struct rb_node *saved_value_new(struct rblist *rblist __maybe_unused,
|
||||
|
Loading…
Reference in New Issue
Block a user