patch-2.1.93 linux/mm/page_alloc.c

Next file: linux/net/core/dev.c
Previous file: linux/kernel/ksyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.92/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -292,8 +292,12 @@
 	spin_lock_irqsave(&page_alloc_lock, flags);
 	RMQUEUE(order, maxorder, (gfp_mask & GFP_DMA));
 	spin_unlock_irqrestore(&page_alloc_lock, flags);
-	if ((gfp_mask & __GFP_WAIT) && try_to_free_pages(gfp_mask,SWAP_CLUSTER_MAX))
-		goto repeat;
+	if (gfp_mask & __GFP_WAIT) {
+		int freed = try_to_free_pages(gfp_mask,SWAP_CLUSTER_MAX);
+		gfp_mask &= ~__GFP_WAIT;	/* go through this only once */
+		if (freed)
+			goto repeat;
+	}
 nopage:
 	return 0;
 }

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