patch-2.1.116 linux/mm/page_alloc.c

Next file: linux/mm/swap.c
Previous file: linux/mm/filemap.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.115/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -263,6 +263,16 @@
 	spin_lock_irqsave(&page_alloc_lock, flags);
 	RMQUEUE(order, (gfp_mask & GFP_DMA));
 	spin_unlock_irqrestore(&page_alloc_lock, flags);
+
+	/*
+	 * If we failed to find anything, we'll return NULL, but we'll
+	 * wake up kswapd _now_ ad even wait for it synchronously if
+	 * we can.. This way we'll at least make some forward progress
+	 * over time.
+	 */
+	wake_up(&kswapd_wait);
+	if (gfp_mask & __GFP_WAIT)
+		schedule();
 nopage:
 	return 0;
 }

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