maps2-make-proc-pid-smaps-optional-under-config_embedded.patch
Subsystems (2)
Quoted 3 lines · Matt
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.
How about a single config option for all these?
===
maps2-CONFIG_PROC_PAGE_MONITOR.patch
Merge the three config options PROC_SMAPS/PROC_CLEAR_REFS/PROC_PAGEMAP and report the approximate memory usage (i386 SMP).
init/Kconfig +9 -27
@@ -636,32 +636,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. - -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. - -config PROC_PAGEMAP - default y - bool "Enable /proc/pid/pagemap support" if EMBEDDED && PROC_FS && MMU - help - The /proc/pid/pagemap interface allows reading the - kernel's virtual memory to page frame mapping to determine which - individual pages a process has mapped and which pages it shares - with other processes. Disabling this interface will reduce the - size of the kernel for small machines. +config PROC_PAGE_MONITOR + default y + bool "Enable /proc page monitoring" if EMBEDDED && PROC_FS && MMU + help + Various /proc files exist to monitor process memory utilization: + /proc/pid/smaps, /proc/pid/clear_refs and /proc/pid/pagemap. + Disabling these interfaces will reduce the size of the kernel by + approximately 4kb. config PROC_KPAGEMAP default y
@@ -670,7 +652,7 @@ config PROC_KPAGEMAP The /proc/pid/kpagemap interface allows reading the kernel's per-page flag and usage counts to gather precise information on page-level memory usage. Disabling this interface - will reduce the size of the kernel for small machines. + will reduce the size of the kernel by around 600 bytes. endmenu # General setup
Quoted 6 lines · Rusty Russell
Quoted 3 lines · Matt
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.How about a single config option for all these?
I suppose. This looks like half a patch though. I think you forgot a quilt add somewhere.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Quoted 10 lines · Matt Mackall
Quoted 6 lines · Rusty Russell
Quoted 3 lines · Matt
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.How about a single config option for all these?
I suppose. This looks like half a patch though. I think you forgot a quilt add somewhere.
Yep: I forgot hg qrefresh 8)
==
maps2-CONFIG_PROC_PAGE_MONITOR.patch
Merge the three config options PROC_SMAPS/PROC_CLEAR_REFS/PROC_PAGEMAP and report the approximate memory usage (i386 SMP).
fs/proc/base.c +2 -10
@@ -2029,13 +2029,9 @@ static const struct pid_entry tgid_base_ REG("mounts", S_IRUGO, mounts), REG("mountstats", S_IRUSR, mountstats), #ifdef CONFIG_MMU -#ifdef CONFIG_PROC_CLEAR_REFS +#ifdef CONFIG_PROC_PAGE_MONITOR REG("clear_refs", S_IWUSR, clear_refs), -#endif -#ifdef CONFIG_PROC_SMAPS REG("smaps", S_IRUGO, smaps), -#endif -#ifdef CONFIG_PROC_PAGEMAP REG("pagemap", S_IRUSR, pagemap), #endif #endif
@@ -2323,13 +2319,9 @@ static const struct pid_entry tid_base_s LNK("exe", exe), REG("mounts", S_IRUGO, mounts), #ifdef CONFIG_MMU -#ifdef CONFIG_PROC_CLEAR_REFS +#ifdef CONFIG_PROC_PAGE_MONITOR REG("clear_refs", S_IWUSR, clear_refs), -#endif -#ifdef CONFIG_PROC_SMAPS REG("smaps", S_IRUGO, smaps), -#endif -#ifdef CONFIG_PROC_PAGEMAP REG("pagemap", S_IRUSR, pagemap), #endif #endif
fs/proc/proc_misc.c +3 -3
@@ -661,7 +661,7 @@ static const struct file_operations proc };#endif -#ifdef CONFIG_PROC_KPAGEMAP +#ifdef CONFIG_PROC_PAGE_MONITOR #define KPMSIZE (sizeof(unsigned long) * 2)#define KPMMASK (KPMSIZE - 1)/* /proc/kpagemap - an array exposing page flags and counts
@@ -688,7 +688,7 @@ static ssize_t kpagemap_read(struct fileint chunk, i; pfn = src /KPMSIZE -1 ; - count =min_t (size_t, count, ((max_pfn +1 ) *KPMSIZE ) - src); + count =min (count, ((max_pfn +1 ) *KPMSIZE ) - src);if (src &KPMMASK || count &KPMMASK )return -EIO ;
@@ -960,7 +960,7 @@ void __init proc_misc_init(void) (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE; }#endif -#ifdef CONFIG_PROC_KPAGEMAP +#ifdef CONFIG_PROC_PAGE_MONITOR proc_kpagemap =create_proc_entry ("kpagemap" ,S_IRUSR ,NULL );if (proc_kpagemap) proc_kpagemap->proc_fops = &proc_kpagemap_operations;
fs/proc/task_mmu.c +38 -42
101 lines not on this page · raw message
init/Kconfig +9 -27
@@ -636,32 +636,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. - -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. - -config PROC_PAGEMAP - default y - bool "Enable /proc/pid/pagemap support" if EMBEDDED && PROC_FS && MMU - help - The /proc/pid/pagemap interface allows reading the - kernel's virtual memory to page frame mapping to determine which - individual pages a process has mapped and which pages it shares - with other processes. Disabling this interface will reduce the - size of the kernel for small machines. +config PROC_PAGE_MONITOR + default y + bool "Enable /proc page monitoring" if EMBEDDED && PROC_FS && MMU + help + Various /proc files exist to monitor process memory utilization: + /proc/pid/smaps, /proc/pid/clear_refs and /proc/pid/pagemap. + Disabling these interfaces will reduce the size of the kernel by + approximately 4kb. config PROC_KPAGEMAP default y
@@ -670,7 +652,7 @@ config PROC_KPAGEMAP The /proc/pid/kpagemap interface allows reading the kernel's per-page flag and usage counts to gather precise information on page-level memory usage. Disabling this interface - will reduce the size of the kernel for small machines. + will reduce the size of the kernel by around 600 bytes. endmenu # General setup