All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Yannick Brosseau <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, ak@linux.intel.com, mingo@kernel.org,
	hpa@zytor.com, acme@redhat.com, scientist@fb.com,
	linux-kernel@vger.kernel.org, zhu.wen-jie@hp.com
Subject: [tip:perf/core] perf tools: Correctly identify anon_hugepage when generating map (v2)
Date: Thu, 26 Nov 2015 23:44:59 -0800	[thread overview]
Message-ID: <tip-b2be5451f660e0ee230969cc24121d9e210a91de@git.kernel.org> (raw)
In-Reply-To: <1448538152-2898-1-git-send-email-scientist@fb.com>

Commit-ID:  b2be5451f660e0ee230969cc24121d9e210a91de
Gitweb:     http://git.kernel.org/tip/b2be5451f660e0ee230969cc24121d9e210a91de
Author:     Yannick Brosseau <scientist@fb.com>
AuthorDate: Thu, 26 Nov 2015 03:42:32 -0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 26 Nov 2015 14:08:17 -0300

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>
---
 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 afc6b56..93d9f1c 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)

      parent reply	other threads:[~2015-11-27  7:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 11:42 [PATCH] perf: Correctly identify anon_hugepage when generating map (v2) Yannick Brosseau
2015-11-26 17:12 ` Arnaldo Carvalho de Melo
2015-11-27  7:44 ` tip-bot for Yannick Brosseau [this message]

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=tip-b2be5451f660e0ee230969cc24121d9e210a91de@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=scientist@fb.com \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.