patch-2.4.0-test4 linux/mm/vmscan.c

Next file: linux/net/atm/mpoa_proc.c
Previous file: linux/mm/slab.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test3/linux/mm/vmscan.c linux/mm/vmscan.c
@@ -440,7 +440,7 @@
 }
 
 /*
- * Check if there is any memory pressure (free_pages < pages_low)
+ * Check if there recently has been memory pressure (zone_wake_kswapd)
  */
 static inline int keep_kswapd_awake(void)
 {
@@ -541,16 +541,16 @@
 			if (--swap_count < 0)
 				break;
 
-		priority--;
-	} while (priority >= 0);
+	} while (--priority >= 0);
 
-	/* Always end on a shrink_mmap.. */
+	/* Always end on a shrink_mmap.., may sleep... */
 	while (shrink_mmap(0, gfp_mask)) {
 		if (!--count)
 			goto done;
 	}
-	/* We return 1 if we are freed some page */
-	return (count != FREE_COUNT);
+	/* We return 1 if we are freed some page, or
+	 * there are no memory pressure remaining   */
+	return (count != FREE_COUNT || !memory_pressure());
  
 done:
 	return 1;
@@ -626,6 +626,7 @@
 	int retval = 1;
 
 	if (gfp_mask & __GFP_WAIT) {
+		current->state = TASK_RUNNING;
 		current->flags |= PF_MEMALLOC;
 		retval = do_try_to_free_pages(gfp_mask);
 		current->flags &= ~PF_MEMALLOC;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)