summaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 6e5eda00d..e179a2932 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -63,7 +63,7 @@ int vm_enough_memory(long pages)
return 1;
free = buffermem >> PAGE_SHIFT;
- free += page_cache_size;
+ free += atomic_read(&page_cache_size);
free += nr_free_pages;
free += nr_swap_pages;
free -= (page_cache.min_percent + buffer_mem.min_percent + 2)*num_physpages/100;
@@ -728,6 +728,10 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
struct vm_area_struct * vma;
unsigned long flags, retval;
+ len = PAGE_ALIGN(len);
+ if (!len)
+ return addr;
+
/*
* mlock MCL_FUTURE?
*/