Skip to content

Commit 36cee69

Browse files
committed
perf tools: Do not remove addr_location.thread in thread__find_map()
The thread__find_map() is to find a map for a given address in the given thread's address space. It searches maps based on the cpu mode and fills various information in the addr_location data structure. It might change al->maps and al->map, but not al->thread. Then I think no reason to not set the al->thread at the beginning. Also get rid of the duplicate 'al->map = NULL' part. Fixes: 0dd5041 ("perf addr_location: Add init/exit/copy functions") Acked-by: Ian Rogers <[email protected]> Acked-by: James Clark <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Suzuki K Poulose <[email protected]> Cc: Mike Leach <[email protected]> Cc: Leo Yan <[email protected]> Cc: John Garry <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Namhyung Kim <[email protected]>
1 parent 628eaa4 commit 36cee69

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tools/perf/util/event.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,14 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
581581
maps__zput(al->maps);
582582
map__zput(al->map);
583583
thread__zput(al->thread);
584+
al->thread = thread__get(thread);
584585

585586
al->addr = addr;
586587
al->cpumode = cpumode;
587588
al->filtered = 0;
588589

589-
if (machine == NULL) {
590-
al->map = NULL;
590+
if (machine == NULL)
591591
return NULL;
592-
}
593592

594593
if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
595594
al->level = 'k';
@@ -605,7 +604,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
605604
al->level = 'u';
606605
} else {
607606
al->level = 'H';
608-
al->map = NULL;
609607

610608
if ((cpumode == PERF_RECORD_MISC_GUEST_USER ||
611609
cpumode == PERF_RECORD_MISC_GUEST_KERNEL) &&
@@ -619,7 +617,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
619617
return NULL;
620618
}
621619
al->maps = maps__get(maps);
622-
al->thread = thread__get(thread);
623620
al->map = map__get(maps__find(maps, al->addr));
624621
if (al->map != NULL) {
625622
/*

0 commit comments

Comments
 (0)