From: Matt Mackall This interface is primarily useful for doing memory profiling and not much use on deployed embedded boxes. Make it optional. Together with /proc/pid/clear_refs, this save a few K. Signed-off-by: Matt Mackall Cc: Jeremy Fitzhardinge Cc: David Rientjes Signed-off-by: Andrew Morton --- fs/proc/base.c | 4 ++++ fs/proc/task_mmu.c | 2 ++ init/Kconfig | 8 ++++++++ 3 files changed, 14 insertions(+) diff -puN fs/proc/base.c~maps2-make-proc-pid-smaps-optional-under-config_embedded fs/proc/base.c --- a/fs/proc/base.c~maps2-make-proc-pid-smaps-optional-under-config_embedded +++ a/fs/proc/base.c @@ -1946,8 +1946,10 @@ static const struct pid_entry tgid_base_ REG("mountstats", S_IRUSR, mountstats), #ifdef CONFIG_MMU REG("clear_refs", S_IWUSR, clear_refs), +#ifdef CONFIG_PROC_SMAPS REG("smaps", S_IRUGO, smaps), #endif +#endif #ifdef CONFIG_SECURITY DIR("attr", S_IRUGO|S_IXUGO, attr_dir), #endif @@ -2229,8 +2231,10 @@ static const struct pid_entry tid_base_s REG("mounts", S_IRUGO, mounts), #ifdef CONFIG_MMU REG("clear_refs", S_IWUSR, clear_refs), +#ifdef CONFIG_PROC_SMAPS REG("smaps", S_IRUGO, smaps), #endif +#endif #ifdef CONFIG_SECURITY DIR("attr", S_IRUGO|S_IXUGO, attr_dir), #endif diff -puN fs/proc/task_mmu.c~maps2-make-proc-pid-smaps-optional-under-config_embedded fs/proc/task_mmu.c --- a/fs/proc/task_mmu.c~maps2-make-proc-pid-smaps-optional-under-config_embedded +++ a/fs/proc/task_mmu.c @@ -314,6 +314,7 @@ const struct file_operations proc_maps_o .release = seq_release_private, }; +#ifdef CONFIG_PROC_SMAPS struct mem_size_stats { struct vm_area_struct *vma; @@ -421,6 +422,7 @@ const struct file_operations proc_smaps_ .llseek = seq_lseek, .release = seq_release_private, }; +#endif static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, void *private) diff -puN init/Kconfig~maps2-make-proc-pid-smaps-optional-under-config_embedded init/Kconfig --- a/init/Kconfig~maps2-make-proc-pid-smaps-optional-under-config_embedded +++ a/init/Kconfig @@ -587,6 +587,14 @@ config SLOB endchoice +config PROC_SMAPS + default y + bool "Enable /proc/pid/smaps support" if EMBEDDED && PROC_FS && MMU + help + The /proc/pid/smaps interface reports a process's private and + shared memory per mapping. Disabling this interface will reduce + the size of the kernel for small machines. + endmenu # General setup config RT_MUTEXES _