]> xenbits.xen.org Git - xenclient/kernel.git/commitdiff
This interface is primarily useful for doing memory profiling and not much use maps2-patches/maps2-make-proc-pid-smaps-optional-under-config_embedded.patch
authorMatt Mackall <mpm@selenic.com>
Tue, 6 Jan 2009 12:06:05 +0000 (12:06 +0000)
committerMatt Mackall <mpm@selenic.com>
Tue, 6 Jan 2009 12:06:05 +0000 (12:06 +0000)
on deployed embedded boxes.  Make it optional.  Together with /proc/pid/smaps,
this save a few K.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/proc/base.c     |    4 ++++
 fs/proc/task_mmu.c |    2 ++
 init/Kconfig       |    9 +++++++++
 3 files changed, 15 insertions(+)

fs/proc/base.c
fs/proc/task_mmu.c
init/Kconfig

index 387cdc421394f8675004b40cde8a8a0fdf56833c..084724a6e5adf19fda9854adeaa27929a96aae33 100644 (file)
@@ -118,7 +118,9 @@ enum pid_directory_inos {
        PROC_TGID_MOUNTSTATS,
        PROC_TGID_WCHAN,
 #ifdef CONFIG_MMU
+#ifdef CONFIG_PROC_CLEAR_REFS
        PROC_TGID_CLEAR_REFS,
+#endif
 #ifdef CONFIG_PROC_SMAPS
        PROC_TGID_SMAPS,
 #endif
@@ -167,7 +169,9 @@ enum pid_directory_inos {
        PROC_TID_MOUNTSTATS,
        PROC_TID_WCHAN,
 #ifdef CONFIG_MMU
+#ifdef CONFIG_PROC_CLEAR_REFS
        PROC_TID_CLEAR_REFS,
+#endif
 #ifdef CONFIG_PROC_SMAPS
        PROC_TID_SMAPS,
 #endif
@@ -233,7 +237,9 @@ static struct pid_entry tgid_base_stuff[] = {
        E(PROC_TGID_MOUNTS,    "mounts",  S_IFREG|S_IRUGO),
        E(PROC_TGID_MOUNTSTATS, "mountstats", S_IFREG|S_IRUSR),
 #ifdef CONFIG_MMU
+#ifdef CONFIG_PROC_CLEAR_REFS
        E(PROC_TGID_CLEAR_REFS, "clear_refs", S_IFREG|S_IWUSR),
+#endif
 #ifdef CONFIG_PROC_SMAPS
        E(PROC_TGID_SMAPS,     "smaps",   S_IFREG|S_IRUSR),
 #endif
@@ -285,7 +291,9 @@ static struct pid_entry tid_base_stuff[] = {
        E(PROC_TID_EXE,        "exe",     S_IFLNK|S_IRWXUGO),
        E(PROC_TID_MOUNTS,     "mounts",  S_IFREG|S_IRUGO),
 #ifdef CONFIG_MMU
+#ifdef CONFIG_PROC_CLEAR_REFS
        E(PROC_TID_CLEAR_REFS, "clear_refs", S_IFREG|S_IWUSR),
+#endif
 #ifdef CONFIG_PROC_SMAPS
        E(PROC_TID_SMAPS,      "smaps",   S_IFREG|S_IRUSR),
 #endif
@@ -1981,10 +1989,12 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
                        inode->i_fop = &proc_mounts_operations;
                        break;
 #ifdef CONFIG_MMU
+#ifdef CONFIG_PROC_CLEAR_REFS
                case PROC_TID_CLEAR_REFS:
                case PROC_TGID_CLEAR_REFS:
                        inode->i_fop = &proc_clear_refs_operations;
                        break;
+#endif
 #ifdef CONFIG_PROC_SMAPS
                case PROC_TID_SMAPS:
                case PROC_TGID_SMAPS:
index 6a88625d2ca3030a2b849f8aaa1e2b48e2c8b104..55a29799aa6a1156e3524c287718af9e16916b09 100644 (file)
@@ -447,6 +447,7 @@ struct file_operations proc_smaps_operations = {
 };
 #endif
 
+#ifdef CONFIG_PROC_CLEAR_REFS
 static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
                                unsigned long end, void *private)
 {
@@ -515,6 +516,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
 struct file_operations proc_clear_refs_operations = {
        .write          = clear_refs_write,
 };
+#endif
 
 #ifdef CONFIG_NUMA
 extern int show_numa_map(struct seq_file *m, void *v);
index 355031356efbbdca94478d6e5a83f372e31a97f5..a4d0c1266b04e41b94eaf83801c87dfc04e8a87c 100644 (file)
@@ -417,6 +417,15 @@ config PROC_SMAPS
           shared memory per mapping. Disabling this interface will reduce
           the size of the kernel for small machines.
 
+config PROC_CLEAR_REFS
+       default y
+       bool "Enable /proc/pid/clear_refs support" if EMBEDDED && PROC_FS && MMU
+       help
+         The /proc/pid/clear_refs interface allows clearing the
+          referenced bits on a process's memory maps to allow monitoring
+          working set size. Disabling this interface will reduce
+          the size of the kernel for small machines.
+
 endmenu                # General setup
 
 config RT_MUTEXES