From: Rik van Riel <riel@surriel.com>
From: Rik van Riel <riel@redhat.com>
To: Johannes Weiner <hannes@saeurebad.de>
Cc: linux-mm@kvack.org
Subject: [RFC][PATCH -mm] vmscan: fix swapout on sequential IO
Date: Wed, 23 Jul 2008 14:41:15 -0400 [thread overview]
Message-ID: <20080723144115.72803eb8@bree.surriel.com> (raw)
Only force the scanning of every LRU list if we could not easily
find a page to evict. This preserves the balancing done by
get_scan_ratio(), while ensuring the VM will make progress
when there is serious memory pressure.
Signed-off-by: Rik van Riel <riel@redhat.com>
---
This should fix the "dd if=/dev/sda of=/dev/null causes swapout"
problem that has been seen with the new split LRU VM.
mm/vmscan.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
Index: linux-2.6.26-rc8-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.26-rc8-mm1.orig/mm/vmscan.c 2008-07-23 14:19:09.000000000 -0400
+++ linux-2.6.26-rc8-mm1/mm/vmscan.c 2008-07-23 14:36:26.000000000 -0400
@@ -1447,24 +1447,27 @@ static unsigned long shrink_zone(int pri
unsigned long nr_to_scan;
unsigned long nr_reclaimed = 0;
unsigned long percent[2]; /* anon @ 0; file @ 1 */
+ unsigned int force_scan = 0;
enum lru_list l;
+ /*
+ * If we do not immediately find pages to evict, put some
+ * pressure on every LRU list to guarantee progress.
+ */
+ if (priority < DEF_PRIORITY - 2)
+ force_scan = 1;
+
get_scan_ratio(zone, sc, percent);
for_each_evictable_lru(l) {
if (scan_global_lru(sc)) {
int file = is_file_lru(l);
- int scan;
- /*
- * Add one to nr_to_scan just to make sure that the
- * kernel will slowly sift through each list.
- */
- scan = zone_page_state(zone, NR_LRU_BASE + l);
+ int scan = zone_page_state(zone, NR_LRU_BASE + l);
if (priority) {
scan >>= priority;
scan = (scan * percent[file]) / 100;
}
- zone->lru[l].nr_scan += scan + 1;
+ zone->lru[l].nr_scan += scan + force_scan;
nr[l] = zone->lru[l].nr_scan;
if (nr[l] >= sc->swap_cluster_max)
zone->lru[l].nr_scan = 0;
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2008-07-23 18:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 18:41 Rik van Riel, Rik van Riel [this message]
2008-07-23 18:48 ` Johannes Weiner
2008-07-23 19:29 ` Rik van Riel
2008-07-23 19:38 ` Johannes Weiner
2008-07-24 6:26 ` KOSAKI Motohiro
2008-07-24 12:20 ` Rik van Riel
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=20080723144115.72803eb8@bree.surriel.com \
--to=riel@surriel.com \
--cc=hannes@saeurebad.de \
--cc=linux-mm@kvack.org \
/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