From patchwork Tue Sep 6 04:58:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 75458 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp360471qgf; Mon, 5 Sep 2016 21:59:39 -0700 (PDT) X-Received: by 10.66.185.14 with SMTP id ey14mr70422102pac.71.1473137979020; Mon, 05 Sep 2016 21:59:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gk9si33254111pac.182.2016.09.05.21.59.38; Mon, 05 Sep 2016 21:59:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754401AbcIFE7J (ORCPT + 27 others); Tue, 6 Sep 2016 00:59:09 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:11995 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752848AbcIFE7E (ORCPT ); Tue, 6 Sep 2016 00:59:04 -0400 Received: from 172.24.1.136 (EHLO szxeml432-hub.china.huawei.com) ([172.24.1.136]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DQQ84624; Tue, 06 Sep 2016 12:58:45 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.235.1; Tue, 6 Sep 2016 12:58:34 +0800 From: Wang Nan To: CC: , , , Wang Nan , Hou Pengyang , He Kuang , "Arnaldo Carvalho de Melo" Subject: [PATCH v2 2/3] tools lib api fs: Add hugetlbfs filesystem detector Date: Tue, 6 Sep 2016 04:58:28 +0000 Message-ID: <1473137909-142064-3-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1473137909-142064-1-git-send-email-wangnan0@huawei.com> References: <1473137909-142064-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.57CE4D05.00FD, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 943bc924e20cbaada393fe68d6ba5ef0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Detect hugetlbfs. hugetlbfs__mountpoint() will be used during recording to help recorder identifying hugetlb mmaps: which should be recognized as anon mapping. Signed-off-by: Wang Nan Reviewed-by: Nilay Vaish Cc: Hou Pengyang Cc: He Kuang Cc: Arnaldo Carvalho de Melo --- tools/lib/api/fs/fs.c | 15 +++++++++++++++ tools/lib/api/fs/fs.h | 1 + 2 files changed, 16 insertions(+) -- 1.8.3.4 diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c index ba7094b..f99f49e4 100644 --- a/tools/lib/api/fs/fs.c +++ b/tools/lib/api/fs/fs.c @@ -34,6 +34,10 @@ #define TRACEFS_MAGIC 0x74726163 #endif +#ifndef HUGETLBFS_MAGIC +#define HUGETLBFS_MAGIC 0x958458f6 +#endif + static const char * const sysfs__fs_known_mountpoints[] = { "/sys", 0, @@ -67,6 +71,10 @@ static const char * const tracefs__known_mountpoints[] = { 0, }; +static const char * const hugetlbfs__known_mountpoints[] = { + 0, +}; + struct fs { const char *name; const char * const *mounts; @@ -80,6 +88,7 @@ enum { FS__PROCFS = 1, FS__DEBUGFS = 2, FS__TRACEFS = 3, + FS__HUGETLBFS = 4, }; #ifndef TRACEFS_MAGIC @@ -107,6 +116,11 @@ static struct fs fs__entries[] = { .mounts = tracefs__known_mountpoints, .magic = TRACEFS_MAGIC, }, + [FS__HUGETLBFS] = { + .name = "hugetlbfs", + .mounts = hugetlbfs__known_mountpoints, + .magic = HUGETLBFS_MAGIC, + }, }; static bool fs__read_mounts(struct fs *fs) @@ -265,6 +279,7 @@ FS(sysfs, FS__SYSFS); FS(procfs, FS__PROCFS); FS(debugfs, FS__DEBUGFS); FS(tracefs, FS__TRACEFS); +FS(hugetlbfs, FS__HUGETLBFS); int filename__read_int(const char *filename, int *value) { diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h index 16c9c2e..a63269f 100644 --- a/tools/lib/api/fs/fs.h +++ b/tools/lib/api/fs/fs.h @@ -21,6 +21,7 @@ FS(sysfs) FS(procfs) FS(debugfs) FS(tracefs) +FS(hugetlbfs) #undef FS