Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1479501

[PATCH 07/12] tools lib api fs: Add hugetlbfs filesystem detector

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 07/12] tools lib api fs: Add hugetlbfs filesystem detector
Date 2016-09-08 22:50 +0200
Message-ID <sfeqJ-2at-11@gated-at.bofh.it> (permalink)
References <sfeqJ-2at-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Wang Nan <wangnan0@huawei.com>

Detect hugetlbfs. hugetlbfs__mountpoint() will be used during recording
to help identifying hugetlb mmaps: which should be recognized as anon
mapping.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Reviewed-by: Nilay Vaish <nilayvaish@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Hou Pengyang <houpengyang@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/1473137909-142064-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/fs/fs.c | 15 +++++++++++++++
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ba7094b945ff..f99f49e4a31e 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 16c9c2ed7c5b..a63269f5d20c 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
 
-- 
2.7.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/12] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 07/12] tools lib api fs: Add hugetlbfs filesystem detector Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 02/12] perf top: Remove old kernel-only symbol filter Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 06/12] perf tools: Recognize hugetlb mapping as anon mapping Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 11/12] perf pmu: Support alternative sysfs cpumask Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 12/12] perf powerpc: Fix build-test failure Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 08/12] perf record: Mark MAP_HUGETLB when synthesizing mmap events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 04/12] perf test vmlinux: Remove dead symbol_filter_t code Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 10/12] perf evlist: Only open events on CPUs an evsel permits Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  [PATCH 03/12] perf machine: Remove machine->symbol_filter and friends Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-08 22:50 +0200
  Re: [GIT PULL 00/12] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-09-09 07:50 +0200

csiph-web