Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751530AbbKZLnE (ORCPT ); Thu, 26 Nov 2015 06:43:04 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:54943 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750791AbbKZLnD (ORCPT ); Thu, 26 Nov 2015 06:43:03 -0500 From: Yannick Brosseau To: , , CC: , , Yannick Brosseau Subject: [PATCH] perf: Correctly identify anon_hugepage when generating map (v2) Date: Thu, 26 Nov 2015 03:42:32 -0800 Message-ID: <1448538152-2898-1-git-send-email-scientist@fb.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-11-26_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1373 Lines: 34 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 receive the string "/anon_hugepage" and do not detect it. We change is_anon_memory to only compare the first part of the string effectively ignoring if the (deleted) part is there or not. Signed-off-by: Yannick Brosseau --- 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..97e11a7 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.6.2 -- 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/