diff options
author | Yannick Brosseau <scientist@fb.com> | 2015-11-26 12:42:32 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-11-26 18:08:17 +0100 |
commit | b2be5451f660e0ee230969cc24121d9e210a91de (patch) | |
tree | f85934b11bfd49342fc6193e26e124d415a08380 /tools/perf/util/map.c | |
parent | perf machine: Adjust dso->long_name for offline module (diff) | |
download | linux-b2be5451f660e0ee230969cc24121d9e210a91de.tar.xz linux-b2be5451f660e0ee230969cc24121d9e210a91de.zip |
perf tools: Correctly identify anon_hugepage when generating map (v2)
When parsing /proc/xxx/maps, the sscanf in perf_event__synthesize_mmap_events
truncate the map name at the space in "/anon_hugepage (deleted)".
is_anon_memory() then only receives the string "/anon_hugepage" and does
not detect it. We change is_anon_memory() to only compare the first
part of the string, effectively ignoring if " (deleted)" is there.
Signed-off-by: Yannick Brosseau <scientist@fb.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Joshua Zhu <zhu.wen-jie@hp.com>
Cc: kernel-team@fb.com
Link: http://lkml.kernel.org/r/1448538152-2898-1-git-send-email-scientist@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r-- | tools/perf/util/map.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index afc6b56cf749..93d9f1ce3baa 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -26,8 +26,8 @@ const char *map_type__name[MAP__NR_TYPES] = { static inline int is_anon_memory(const char *filename) { return !strcmp(filename, "//anon") || - !strcmp(filename, "/dev/zero (deleted)") || - !strcmp(filename, "/anon_hugepage (deleted)"); + !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) || + !strncmp(filename, "/anon_hugepage", sizeof("/anon_hugepage") - 1); } static inline int is_no_dso_memory(const char *filename) |