patch-2.1.27 linux/mm/mmap.c

Next file: linux/net/802/cl2llc.c
Previous file: linux/kernel/sysctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.26/linux/mm/mmap.c linux/mm/mmap.c
@@ -46,6 +46,8 @@
 /* SLAB cache for vm_area_struct's. */
 kmem_cache_t *vm_area_cachep;
 
+int sysctl_overcommit_memory;
+
 /*
  * Check that a process has enough memory to allocate a
  * new virtual mapping.
@@ -58,6 +60,11 @@
 	 * fool it, but this should catch most mistakes.
 	 */
 	long freepages;
+	
+        /* sometimes we want to use more memory than we have. */
+	if (sysctl_overcommit_memory)
+	    return 1;
+
 	freepages = buffermem >> PAGE_SHIFT;
 	freepages += page_cache_size;
 	freepages >>= 1;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov