2.2.15pre4 VM fix

Rik van Riel riel en nl.linux.org
Mie Ene 26 06:52:30 CST 2000


Hi Alan,

with the attached patch I hope to have fixed the 2.2.15pre4
VM problems. I didn't manage to break it myself, but maybe
one of the dear readers has a machine where they are able
to do so...

Please give this patch (against 2.2.15pre4) a solid beating
and report back to us. Thanks all!

regards,

Rik
--
The Internet is not a network of computers. It is a network
of people. That is its real strength.


--- mm/page_alloc.c.orig	Tue Jan 25 00:01:43 2000
+++ mm/page_alloc.c	Wed Jan 26 01:16:21 2000
@@ -210,6 +210,12 @@
 	 */
 	if (!(current->flags & PF_MEMALLOC)) {
 		int freed;
+		if (current->state != TASK_RUNNING && (gfp_mask & __GFP_WAIT)) {
+			printk("gfp called by non-running (%d) task from %p!\n",
+				current->state, __builtin_return_address(0));
+			/* if we're not running, we can't sleep */
+			gfp_mask &= ~__GFP_WAIT;
+		}
 
 		if (nr_free_pages <= freepages.low) {
 			wake_up_interruptible(&kswapd_wait);
@@ -224,6 +230,9 @@
 		current->flags |= PF_MEMALLOC;
 		freed = try_to_free_pages(gfp_mask);
 		current->flags &= ~PF_MEMALLOC;
+
+		if ((gfp_mask & __GFP_MED) && nr_free_pages > freepages.min / 2)
+			goto ok_to_allocate;
 
 		if (!freed && !(gfp_mask & __GFP_HIGH))
 			goto nopage;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda