[PATCH] reclaim dirty dead swapcache pages

Marcelo Tosatti (marcelo@conectiva.com.br)
Wed, 30 May 2001 14:51:08 -0300 (BRT)


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)) {

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