patch-2.1.92 linux/mm/page_alloc.c

Next file: linux/mm/vmalloc.c
Previous file: linux/kernel/sysctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.91/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -126,7 +126,17 @@
 {
 	int retval = 0;
 	unsigned long flags;
-	struct free_area_struct * list = NULL;
+	struct free_area_struct * list;
+
+	/*
+	 * If we have more than about 6% of all memory free,
+	 * consider it to be good enough for anything.
+	 * It may not be, due to fragmentation, but we
+	 * don't want to keep on forever trying to find
+	 * free unfragmented memory.
+	 */
+	if (nr_free_pages > num_physpages >> 4)
+		return nr+1;
 
 	list = free_area + NR_MEM_LISTS;
 	spin_lock_irqsave(&page_alloc_lock, flags);

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