aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorJerome Marchand <jmarchan@redhat.com>2013-11-12 18:08:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:11 -0500
commit00619bcc44d6b779aa366130b354153c222e4380 (patch)
tree5a885f81a351dfc6ca471823388d89a739406862 /fs/proc
parent715ea41e60277f28f84d6c937737350e00955d56 (diff)
mm: factor commit limit calculation
The same calculation is currently done in three differents places. Factor that code so future changes has to be made at only one place. [akpm@linux-foundation.org: uninline vm_commit_limit()] Signed-off-by: Jerome Marchand <jmarchan@redhat.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/meminfo.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 59d85d608898..c805d5b69ba1 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -24,7 +24,6 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
24{ 24{
25 struct sysinfo i; 25 struct sysinfo i;
26 unsigned long committed; 26 unsigned long committed;
27 unsigned long allowed;
28 struct vmalloc_info vmi; 27 struct vmalloc_info vmi;
29 long cached; 28 long cached;
30 unsigned long pages[NR_LRU_LISTS]; 29 unsigned long pages[NR_LRU_LISTS];
@@ -37,8 +36,6 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
37 si_meminfo(&i); 36 si_meminfo(&i);
38 si_swapinfo(&i); 37 si_swapinfo(&i);
39 committed = percpu_counter_read_positive(&vm_committed_as); 38 committed = percpu_counter_read_positive(&vm_committed_as);
40 allowed = ((totalram_pages - hugetlb_total_pages())
41 * sysctl_overcommit_ratio / 100) + total_swap_pages;
42 39
43 cached = global_page_state(NR_FILE_PAGES) - 40 cached = global_page_state(NR_FILE_PAGES) -
44 total_swapcache_pages() - i.bufferram; 41 total_swapcache_pages() - i.bufferram;
@@ -147,7 +144,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
147 K(global_page_state(NR_UNSTABLE_NFS)), 144 K(global_page_state(NR_UNSTABLE_NFS)),
148 K(global_page_state(NR_BOUNCE)), 145 K(global_page_state(NR_BOUNCE)),
149 K(global_page_state(NR_WRITEBACK_TEMP)), 146 K(global_page_state(NR_WRITEBACK_TEMP)),
150 K(allowed), 147 K(vm_commit_limit()),
151 K(committed), 148 K(committed),
152 (unsigned long)VMALLOC_TOTAL >> 10, 149 (unsigned long)VMALLOC_TOTAL >> 10,
153 vmi.used >> 10, 150 vmi.used >> 10,