Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754164AbbK0HpZ (ORCPT ); Fri, 27 Nov 2015 02:45:25 -0500 Received: from terminus.zytor.com ([198.137.202.10]:42425 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050AbbK0HpS (ORCPT ); Fri, 27 Nov 2015 02:45:18 -0500 Date: Thu, 26 Nov 2015 23:44:59 -0800 From: tip-bot for Yannick Brosseau Message-ID: 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 Reply-To: linux-kernel@vger.kernel.org, zhu.wen-jie@hp.com, scientist@fb.com, acme@redhat.com, hpa@zytor.com, ak@linux.intel.com, mingo@kernel.org, tglx@linutronix.de In-Reply-To: <1448538152-2898-1-git-send-email-scientist@fb.com> References: <1448538152-2898-1-git-send-email-scientist@fb.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Correctly identify anon_hugepage when generating map (v2) Git-Commit-ID: b2be5451f660e0ee230969cc24121d9e210a91de X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2046 Lines: 47 Commit-ID: b2be5451f660e0ee230969cc24121d9e210a91de Gitweb: http://git.kernel.org/tip/b2be5451f660e0ee230969cc24121d9e210a91de Author: Yannick Brosseau AuthorDate: Thu, 26 Nov 2015 03:42:32 -0800 Committer: Arnaldo Carvalho de Melo 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 Tested-by: Arnaldo Carvalho de Melo Cc: Andi Kleen Cc: Joshua Zhu 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 --- 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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/