Skip to contentSkip to conversation

perf top: Use __map__is_kernel()

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 2, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  68766bfa56476ee07217fc7f24a1d93f43125036
Gitweb:     https://git.kernel.org/tip/68766bfa56476ee07217fc7f24a1d93f43125036
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 23 Apr 2018 16:40:02 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 26 Apr 2018 09:30:27 -0300

perf top: Use __map__is_kernel()

Shorter form to figure out if a given map is the kernel one and also reduces the number of code accessing MAP__{FUNCTION,VARIABLE}, that should go away at some point.

---
 tools/perf/builtin-top.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-top.c +2 -2
index f39bd60d2708..4e975f3ee3be 100644
@@ -750,7 +750,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
 		machine->kptr_restrict_warned = true;
 	}
 
-	if (al.sym == NULL) {
+	if (al.sym == NULL && al.map != NULL) {
 		const char *msg = "Kernel samples will not be resolved.\n";
 		/*
 		 * As we do lazy loading of symtabs we only will know if the
@@ -764,7 +764,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
 		 * invalid --vmlinux ;-)
 		 */
 		if (!machine->kptr_restrict_warned && !top->vmlinux_warned &&
-		    al.map == machine->vmlinux_maps[MAP__FUNCTION] &&
+		    __map__is_kernel(al.map) &&
 		    RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION])) {
 			if (symbol_conf.vmlinux_name) {
 				char serr[256];