linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Yannick Brosseau <scientist@fb.com>,
	Andi Kleen <ak@linux.intel.com>, Joshua Zhu <zhu.wen-jie@hp.com>,
	kernel-team@fb.com, Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/13] perf tools: Correctly identify anon_hugepage when generating map (v2)
Date: Thu, 26 Nov 2015 17:46:04 -0300	[thread overview]
Message-ID: <1448570771-5430-7-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1448570771-5430-1-git-send-email-acme@kernel.org>

From: Yannick Brosseau <scientist@fb.com>

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>
---
 tools/perf/util/map.c | 4 ++--
 1 file 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)
-- 
2.1.0


  parent reply	other threads:[~2015-11-26 20:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 20:45 [GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-11-26 20:45 ` [PATCH 01/13] perf callchain: Honor hide_unresolved Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 02/13] perf top: Fix freeze on --call-graph flat/folded Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 03/13] perf script: Remove default_scripting_ops Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 04/13] perf build: Fix traceevent plugins build race Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 05/13] perf machine: Adjust dso->long_name for offline module Arnaldo Carvalho de Melo
2015-11-26 20:46 ` Arnaldo Carvalho de Melo [this message]
2015-11-26 20:46 ` [PATCH 07/13] perf script: Pass perf_script into process_event Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 08/13] tools build: Use fixdep with OUTPUT path prefix Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 09/13] perf symbols: Refactor vmlinux_path__init() to ease path additions Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 10/13] perf symbols: Add the path to vmlinux.debug Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 11/13] perf stat: Clear sample_(type|period) for counting Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 12/13] perf evlist: Display WEIGHT sample type bit Arnaldo Carvalho de Melo
2015-11-26 20:46 ` [PATCH 13/13] bpf tools: Add helper function for updating bpf maps elements Arnaldo Carvalho de Melo
2015-11-27  7:30 ` [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448570771-5430-7-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=scientist@fb.com \
    --cc=zhu.wen-jie@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).