aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 8a49df4c736..2c1c2cb0e2e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(vm_get_page_prot);
86int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ 86int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
87int sysctl_overcommit_ratio = 50; /* default is 50% */ 87int sysctl_overcommit_ratio = 50; /* default is 50% */
88int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; 88int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
89atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); 89struct percpu_counter vm_committed_as;
90 90
91/* 91/*
92 * Check that a process has enough memory to allocate a new virtual 92 * Check that a process has enough memory to allocate a new virtual
@@ -180,11 +180,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
180 if (mm) 180 if (mm)
181 allowed -= mm->total_vm / 32; 181 allowed -= mm->total_vm / 32;
182 182
183 /* 183 if (percpu_counter_read_positive(&vm_committed_as) < allowed)
184 * cast `allowed' as a signed long because vm_committed_space
185 * sometimes has a negative value
186 */
187 if (atomic_long_read(&vm_committed_space) < (long)allowed)
188 return 0; 184 return 0;
189error: 185error:
190 vm_unacct_memory(pages); 186 vm_unacct_memory(pages);
@@ -2491,4 +2487,8 @@ void mm_drop_all_locks(struct mm_struct *mm)
2491 */ 2487 */
2492void __init mmap_init(void) 2488void __init mmap_init(void)
2493{ 2489{
2490 int ret;
2491
2492 ret = percpu_counter_init(&vm_committed_as, 0);
2493 VM_BUG_ON(ret);
2494} 2494}