From: Marcelo Tosatti <marcelo@conectiva.com.br>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: lkml <linux-kernel@vger.kernel.org>, linux-mm@kvack.org
Subject: [PATCH] Reap dead swap cache earlier v2
Date: Wed, 6 Jun 2001 17:07:41 -0300 (BRT) [thread overview]
Message-ID: <Pine.LNX.4.21.0106061705250.3769-100000@freak.distro.conectiva> (raw)
Hi,
As suggested by Linus, I've cleaned the reapswap code to be contained
inside an inline function. (yes, the if statement is really ugly)
Tested and against 2.4.6pre1.
--- linux.orig/mm/vmscan.c Wed Jun 6 18:16:45 2001
+++ linux/mm/vmscan.c Wed Jun 6 18:28:26 2001
@@ -407,6 +407,27 @@
memory_pressure++;
return page;
}
+/*
+ * Check for dead swap cache pages and clean them, forcing
+ * those pages to be freed earlier.
+ */
+static inline int clean_dead_swap_page (struct page* page)
+{
+ int ret = 0;
+ if (!TryLockPage (page)) {
+ if (PageSwapCache(page) && PageDirty(page) &&
+ (page_count(page) - !!page->buffers) == 1 &&
+ swap_count(page) == 1) {
+ ClearPageDirty(page);
+ ClearPageReferenced(page);
+ page->age = 0;
+ ret = 1;
+ }
+ UnlockPage(page);
+ }
+ return ret;
+}
+
/**
* page_launder - clean dirty inactive pages, move to inactive_clean list
@@ -456,6 +477,12 @@
continue;
}
+ /*
+ * Check for dead swap cache pages
+ * before doing any other checks.
+ */
+ clean_dead_swap_page(page);
+
/* Page is or was in use? Move it to the active list. */
if (PageReferenced(page) || page->age > 0 ||
page->zone->free_pages > page->zone->pages_high ||
@@ -666,6 +693,15 @@
printk("VM: refill_inactive, wrong page on list.\n");
list_del(page_lru);
nr_active_pages--;
+ continue;
+ }
+
+ /*
+ * Special case for dead swap cache pages.
+ */
+ if (clean_dead_swap_page(page)) {
+ deactivate_page_nolock(page);
+ nr_deactivated++;
continue;
}
--
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-mm.org/
next reply other threads:[~2001-06-06 20:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-06 20:07 Marcelo Tosatti [this message]
2001-06-07 14:47 ` John Stoffel
2001-06-07 15:44 ` Hugh Dickins
2001-06-07 19:07 ` Jonathan Morton
2001-06-07 17:38 ` Marcelo Tosatti
2001-06-07 19:31 ` Jonathan Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.21.0106061705250.3769-100000@freak.distro.conectiva \
--to=marcelo@conectiva.com.br \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox