linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.4.0-ac8/9  page_launder() fix
@ 2001-02-10 22:53 Rik van Riel
  2001-02-10 22:33 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Rik van Riel @ 2001-02-10 22:53 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, Marcelo Tosatti

Hi,

the patch below should make page_launder() more well-behaved
than it is in -ac8 and -ac9 ... note, however, that this thing
is still completely untested and only in theory makes page_launder
behave better ;)

Since there seems to be a lot of VM testing going on at the
moment I thought I might as well send it out now so I can get
some feedback before I get into the airplane towards sweden
tomorrow...

cheers,

Rik
--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com/



--- linux-2.4.1-ac8/mm/vmscan.c.orig	Fri Feb  9 15:04:16 2001
+++ linux-2.4.1-ac8/mm/vmscan.c	Sat Feb 10 20:50:40 2001
@@ -413,7 +413,7 @@
  * This code is heavily inspired by the FreeBSD source code. Thanks
  * go out to Matthew Dillon.
  *
- * XXX: restrict number of pageouts in flight...
+ * XXX: restrict number of pageouts in flight by ->writepage...
  */
 #define MAX_LAUNDER 		(1 << page_cluster)
 int page_launder(int gfp_mask, int user)
@@ -514,7 +514,10 @@
 			spin_unlock(&pagemap_lru_lock);
 
 			writepage(page);
-			flushed_pages++;
+			/* XXX: all ->writepage()s should use nr_async_pages */
+			if (!PageSwapCache(page))
+				flushed_pages++;
+			maxlaunder--;
 			page_cache_release(page);
 
 			/* And re-start the thing.. */
@@ -636,14 +639,16 @@
 		 * with the paging load in the system and doesn't have
 		 * the IO storm problem, so it just flushes all pages
 		 * needed to fix the free shortage.
-		 *
-		 * XXX: keep track of nr_async_pages like the old swap
-		 * code did?
 		 */
-		if (user)
+		maxlaunder = shortage;
+		maxlaunder -= flushed_pages;
+		maxlaunder -= atomic_read(&nr_async_pages);
+	
+		if (maxlaunder <= 0)
+			goto out;
+
+		if (user && maxlaunder > MAX_LAUNDER)
 			maxlaunder = MAX_LAUNDER;
-		else
-			maxlaunder = shortage;
 
 		/*
 		 * If we are called by a user program, we need to free
@@ -667,6 +672,7 @@
 	/*
 	 * Return the amount of pages we freed or made freeable.
 	 */
+out:
 	return freed_pages + flushed_pages;
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-02-10 22:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-10 22:53 [PATCH] 2.4.0-ac8/9 page_launder() fix Rik van Riel
2001-02-10 22:33 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox