public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reclaim dirty dead swapcache pages
@ 2001-05-30 17:51 Marcelo Tosatti
  2001-05-30 20:32 ` Marcelo Tosatti
  0 siblings, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2001-05-30 17:51 UTC (permalink / raw)
  To: lkml, Linus Torvalds; +Cc: Alan Cox


Hi, 

The following untested patch against 2.4.5-ac2 makes page_launder() free
dead swap cache pages by ignoring their age and/or referenced bits.

refill_inactive_scan() will move those pages to the inactive dirty list
whatever their age/referenced bit.

Testers are welcome (hum, needed). 

Linus,

I gaveup on the writepage() changes because 

1) it would (and it could not) ignore the page age. 
2) changing the API for such a reason on 2.4 is not reasonable, I think. 

I definately want writepage() changed to include the 'priority' argument,
in 2.5. 

--- linux.orig/mm/vmscan.c	Wed May 30 14:51:21 2001
+++ linux/mm/vmscan.c	Wed May 30 16:18:41 2001
@@ -461,6 +461,28 @@
 			continue;
 		}
 
+		/*
+		 * FIXME: this is a hack.
+		 *
+		 * Check for dead swap cache pages and clean
+		 * them as fast as possible, before doing any other checks.
+		 *
+		 * Note: We are guaranteeing that this page will never 
+		 * be touched in the future because a dirty page with no
+		 * other users than the swapcache will never be referenced
+		 * again.
+		 * 
+		 */
+
+		if (PageSwapCache(page) && PageDirty(page) &&
+				(page_count(page) - !!page->buffers) == 1 &&
+				swap_count(page) == 1) { 
+			ClearPageDirty(page);
+			ClearPageReferenced(page);
+			page->age = 0;
+		}
+
+			
 		/* Page is or was in use?  Move it to the active list. */
 		if (PageReferenced(page) || page->age > 0 ||
 				(!page->buffers && page_count(page) > 1) ||
@@ -686,6 +708,21 @@
 			nr_active_pages--;
 			continue;
 		}
+		
+		/*
+		 * FIXME: hack
+		 *
+		 * Special case for dead swap cache pages.
+		 * See comment on page_launder() for more info.
+		 */
+		if (PageSwapCache(page) && PageDirty(page) &&
+				(page_count(page) - !!page->buffers) == 1 &&
+				swap_count(page) == 1) {
+			deactivate_page_nolock(page);
+			nr_deactivated++;
+			continue;
+		}
+
 
 		/* Do aging on the pages. */
 		if (PageTestandClearReferenced(page)) {


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

end of thread, other threads:[~2001-05-31 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-30 17:51 [PATCH] reclaim dirty dead swapcache pages Marcelo Tosatti
2001-05-30 20:32 ` Marcelo Tosatti
2001-05-30 22:15   ` J . A . Magallon
2001-05-30 20:48     ` Marcelo Tosatti
2001-05-31 18:20   ` Vasco Figueira
2001-05-31 19:31     ` Vasco Figueira

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