redundant call to vm_enough_memory

Message ID
State New, archived
Headers show
  • redundant call to vm_enough_memory
Related show

Commit Message

Werner Almesberger Feb. 9, 2001, 12:42 a.m. UTC
This patch removes a redundant call to vm_enough_memory from
mm/mmap.c:sys_brk. Exactly the same test is made in mm/mmap.c:do_brk,
with the exception that the latter is done after calling do_munmap.

Note that do_munmap in do_brk has no effect when called from sys_brk,
because the check for find_vma_intersection only lets us pass if there
are no memory objects in the way.

The patch is for 2.4.2-pre1, with my /proc/sys/vm/max_map_count patch
applied. (The latter only changes some offsets, not the context of this

- Werner

------------------------------------ patch ------------------------------------


--- linux.orig/mm/mmap.c	Mon Jan 29 17:10:41 2001
+++ linux/mm/mmap.c	Fri Feb  9 01:12:55 2001
@@ -148,10 +149,6 @@ 
 	if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
 		goto out;
-	/* Check if we have enough memory.. */
-	if (!vm_enough_memory((newbrk-oldbrk) >> PAGE_SHIFT))
-		goto out;
 	/* Ok, looks good - let it rip. */
 	if (do_brk(oldbrk, newbrk-oldbrk) != oldbrk)
 		goto out;