diff options
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index 72eda4aee2cb..b571ef707428 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -62,11 +62,11 @@ void *high_memory; | |||
62 | struct page *mem_map; | 62 | struct page *mem_map; |
63 | unsigned long max_mapnr; | 63 | unsigned long max_mapnr; |
64 | unsigned long num_physpages; | 64 | unsigned long num_physpages; |
65 | atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); | 65 | struct percpu_counter vm_committed_as; |
66 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ | 66 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ |
67 | int sysctl_overcommit_ratio = 50; /* default is 50% */ | 67 | int sysctl_overcommit_ratio = 50; /* default is 50% */ |
68 | int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT; | 68 | int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT; |
69 | int sysctl_nr_trim_pages = 1; /* page trimming behaviour */ | 69 | int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS; |
70 | int heap_stack_gap = 0; | 70 | int heap_stack_gap = 0; |
71 | 71 | ||
72 | atomic_long_t mmap_pages_allocated; | 72 | atomic_long_t mmap_pages_allocated; |
@@ -463,6 +463,10 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) | |||
463 | */ | 463 | */ |
464 | void __init mmap_init(void) | 464 | void __init mmap_init(void) |
465 | { | 465 | { |
466 | int ret; | ||
467 | |||
468 | ret = percpu_counter_init(&vm_committed_as, 0); | ||
469 | VM_BUG_ON(ret); | ||
466 | vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC); | 470 | vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC); |
467 | } | 471 | } |
468 | 472 | ||
@@ -511,8 +515,6 @@ static void add_nommu_region(struct vm_region *region) | |||
511 | 515 | ||
512 | validate_nommu_regions(); | 516 | validate_nommu_regions(); |
513 | 517 | ||
514 | BUG_ON(region->vm_start & ~PAGE_MASK); | ||
515 | |||
516 | parent = NULL; | 518 | parent = NULL; |
517 | p = &nommu_region_tree.rb_node; | 519 | p = &nommu_region_tree.rb_node; |
518 | while (*p) { | 520 | while (*p) { |
@@ -1847,12 +1849,9 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) | |||
1847 | if (mm) | 1849 | if (mm) |
1848 | allowed -= mm->total_vm / 32; | 1850 | allowed -= mm->total_vm / 32; |
1849 | 1851 | ||
1850 | /* | 1852 | if (percpu_counter_read_positive(&vm_committed_as) < allowed) |
1851 | * cast `allowed' as a signed long because vm_committed_space | ||
1852 | * sometimes has a negative value | ||
1853 | */ | ||
1854 | if (atomic_long_read(&vm_committed_space) < (long)allowed) | ||
1855 | return 0; | 1853 | return 0; |
1854 | |||
1856 | error: | 1855 | error: |
1857 | vm_unacct_memory(pages); | 1856 | vm_unacct_memory(pages); |
1858 | 1857 | ||