diff options
| author | Takashi Iwai <tiwai@suse.de> | 2009-05-12 11:57:09 +0200 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2009-05-12 11:57:09 +0200 |
| commit | ddc4097b77bbb227851a44287acb2fb8a9896cc1 (patch) | |
| tree | 319d098879bed7c45543d983de8becd509701b22 /mm/mmap.c | |
| parent | bec4c99e8637b5b8bd4b0513eacb51da25885e3b (diff) | |
| parent | ae31c1fbdbb18d917b0a1139497c2dbd35886989 (diff) | |
Merge branch 'topic/drvdata-fix' into topic/asoc
Diffstat (limited to 'mm/mmap.c')
| -rw-r--r-- | mm/mmap.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index 3303d1ba8e8..6b7b1a95944 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -85,7 +85,7 @@ EXPORT_SYMBOL(vm_get_page_prot); int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ int sysctl_overcommit_ratio = 50; /* default is 50% */ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; -atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); +struct percpu_counter vm_committed_as; /* * Check that a process has enough memory to allocate a new virtual @@ -179,11 +179,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) if (mm) allowed -= mm->total_vm / 32; - /* - * cast `allowed' as a signed long because vm_committed_space - * sometimes has a negative value - */ - if (atomic_long_read(&vm_committed_space) < (long)allowed) + if (percpu_counter_read_positive(&vm_committed_as) < allowed) return 0; error: vm_unacct_memory(pages); @@ -2481,4 +2477,8 @@ void mm_drop_all_locks(struct mm_struct *mm) */ void __init mmap_init(void) { + int ret; + + ret = percpu_counter_init(&vm_committed_as, 0); + VM_BUG_ON(ret); } |
