diff options
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(vm_get_page_prot); | |||
86 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ | 86 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ |
87 | int sysctl_overcommit_ratio = 50; /* default is 50% */ | 87 | int sysctl_overcommit_ratio = 50; /* default is 50% */ |
88 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; | 88 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; |
89 | atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); | 89 | struct 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; |
189 | error: | 185 | error: |
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 | */ |
2492 | void __init mmap_init(void) | 2488 | void __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 | } |