Skip to contentSkip to conversation

redundant call to vm_enough_memory

PATCH New Werner Almesberger 1 participant 1 message Feb 9, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 redundant call to vm_enough_memory

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 patch.)

- Werner

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

mm/mmap.c +0 -4
@@ -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;
Signature · 7 lines
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH           [email protected] /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/