From: Martin Hicks <mort@sgi.com>
To: Linux MM <linux-mm@kvack.org>, Andrew Morton <akpm@osdl.org>
Cc: Ray Bryant <raybry@engr.sgi.com>
Subject: [PATCH 1/4] VM: add may_swap flag to scan_control
Date: Wed, 1 Jun 2005 10:22:41 -0400 [thread overview]
Message-ID: <20050601142241.GT14894@localhost> (raw)
In-Reply-To: <20050601141154.GN14894@localhost>
This adds an extra switch to the scan_control struct. It simply
lets the reclaim code know if its allowed to swap pages out.
This was required for a simple per-zone reclaimer. Without this
addition pages would be swapped out as soon as a zone ran out of
memory and the early reclaim kicked in.
Signed-off-by: Martin Hicks <mort@sgi.com>
mm/vmscan.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
Index: linux-2.6.12-rc5-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.12-rc5-mm1.orig/mm/vmscan.c 2005-05-26 12:27:01.000000000 -0700
+++ linux-2.6.12-rc5-mm1/mm/vmscan.c 2005-05-26 12:27:05.000000000 -0700
@@ -74,6 +74,9 @@ struct scan_control {
int may_writepage;
+ /* Can pages be swapped as part of reclaim? */
+ int may_swap;
+
/* This context's SWAP_CLUSTER_MAX. If freeing memory for
* suspend, we effectively ignore SWAP_CLUSTER_MAX.
* In this context, it doesn't matter that we scan the
@@ -414,7 +417,7 @@ static int shrink_list(struct list_head
* Anonymous process memory has backing store?
* Try to allocate it some swap space here.
*/
- if (PageAnon(page) && !PageSwapCache(page)) {
+ if (PageAnon(page) && !PageSwapCache(page) && sc->may_swap) {
void *cookie = page->mapping;
pgoff_t index = page->index;
@@ -930,6 +933,7 @@ int try_to_free_pages(struct zone **zone
sc.gfp_mask = gfp_mask;
sc.may_writepage = 0;
+ sc.may_swap = 1;
inc_page_state(allocstall);
@@ -1030,6 +1034,7 @@ loop_again:
total_reclaimed = 0;
sc.gfp_mask = GFP_KERNEL;
sc.may_writepage = 0;
+ sc.may_swap = 1;
sc.nr_mapped = read_page_state(nr_mapped);
inc_page_state(pageoutrun);
--
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:"aart@kvack.org"> aart@kvack.org </a>
next parent reply other threads:[~2005-06-01 14:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050601141154.GN14894@localhost>
2005-06-01 14:22 ` Martin Hicks [this message]
2005-06-01 14:23 ` [PATCH 2/4] VM: early zone reclaim Martin Hicks
2005-06-01 14:23 ` [PATCH 3/4] VM: add __GFP_NORECLAIM Martin Hicks
2005-06-01 14:23 ` [PATCH 4/4] VM: rate limit early reclaim Martin Hicks
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=20050601142241.GT14894@localhost \
--to=mort@sgi.com \
--cc=akpm@osdl.org \
--cc=linux-mm@kvack.org \
--cc=raybry@engr.sgi.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