From: Matt Mackall Date: Tue, 6 Jan 2009 12:06:05 +0000 (+0000) Subject: This interface is primarily useful for doing memory profiling and not much use X-Git-Tag: maps2-patches/maps2-regroup-task_mmu-by-interface.patch X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c5e7cd6a8a25a6417112127b9e805b526cd596da;p=xenclient%2Fkernel.git 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 --git a/fs/proc/base.c b/fs/proc/base.c index d930b045..387cdc42 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -119,8 +119,10 @@ enum pid_directory_inos { PROC_TGID_WCHAN, #ifdef CONFIG_MMU PROC_TGID_CLEAR_REFS, +#ifdef CONFIG_PROC_SMAPS PROC_TGID_SMAPS, #endif +#endif #ifdef CONFIG_SCHEDSTATS PROC_TGID_SCHEDSTAT, #endif @@ -166,8 +168,10 @@ enum pid_directory_inos { PROC_TID_WCHAN, #ifdef CONFIG_MMU PROC_TID_CLEAR_REFS, +#ifdef CONFIG_PROC_SMAPS PROC_TID_SMAPS, #endif +#endif #ifdef CONFIG_SCHEDSTATS PROC_TID_SCHEDSTAT, #endif @@ -230,8 +234,10 @@ static struct pid_entry tgid_base_stuff[] = { E(PROC_TGID_MOUNTSTATS, "mountstats", S_IFREG|S_IRUSR), #ifdef CONFIG_MMU E(PROC_TGID_CLEAR_REFS, "clear_refs", S_IFREG|S_IWUSR), +#ifdef CONFIG_PROC_SMAPS E(PROC_TGID_SMAPS, "smaps", S_IFREG|S_IRUSR), #endif +#endif #ifdef CONFIG_SECURITY E(PROC_TGID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), #endif @@ -280,8 +286,10 @@ static struct pid_entry tid_base_stuff[] = { E(PROC_TID_MOUNTS, "mounts", S_IFREG|S_IRUGO), #ifdef CONFIG_MMU E(PROC_TID_CLEAR_REFS, "clear_refs", S_IFREG|S_IWUSR), +#ifdef CONFIG_PROC_SMAPS E(PROC_TID_SMAPS, "smaps", S_IFREG|S_IRUSR), #endif +#endif #ifdef CONFIG_SECURITY E(PROC_TID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), #endif @@ -1977,10 +1985,12 @@ static struct dentry *proc_pident_lookup(struct inode *dir, case PROC_TGID_CLEAR_REFS: inode->i_fop = &proc_clear_refs_operations; break; +#ifdef CONFIG_PROC_SMAPS case PROC_TID_SMAPS: case PROC_TGID_SMAPS: inode->i_fop = &proc_smaps_operations; break; +#endif #endif case PROC_TID_MOUNTSTATS: case PROC_TGID_MOUNTSTATS: diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 2479a258..6a88625d 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -337,6 +337,7 @@ struct file_operations proc_maps_operations = { .release = seq_release_private, }; +#ifdef CONFIG_PROC_SMAPS struct mem_size_stats { struct vm_area_struct *vma; @@ -444,6 +445,7 @@ struct file_operations proc_smaps_operations = { .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 --git a/init/Kconfig b/init/Kconfig index 68f973af..35503135 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -409,6 +409,14 @@ config VM_EVENT_COUNTERS option allows the disabling of the VM event counters. /proc/vmstat will only show page counts. +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