Commit 52a8363e authored by Christoph Lameter's avatar Christoph Lameter Committed by Linus Torvalds

[PATCH] mm: improve function of sc->may_writepage

Make sc->may_writepage control the writeout behavior of shrink_list.

Remove the laptop_mode trick from shrink_list and instead set may_writepage
in try_to_free_pages properly.
Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ce2ea89b
...@@ -492,7 +492,7 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) ...@@ -492,7 +492,7 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
goto keep_locked; goto keep_locked;
if (!may_enter_fs) if (!may_enter_fs)
goto keep_locked; goto keep_locked;
if (laptop_mode && !sc->may_writepage) if (!sc->may_writepage)
goto keep_locked; goto keep_locked;
/* Page is dirty, try to write it out here */ /* Page is dirty, try to write it out here */
...@@ -1170,7 +1170,7 @@ int try_to_free_pages(struct zone **zones, gfp_t gfp_mask) ...@@ -1170,7 +1170,7 @@ int try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
int i; int i;
sc.gfp_mask = gfp_mask; sc.gfp_mask = gfp_mask;
sc.may_writepage = 0; sc.may_writepage = !laptop_mode;
sc.may_swap = 1; sc.may_swap = 1;
inc_page_state(allocstall); inc_page_state(allocstall);
...@@ -1273,7 +1273,7 @@ loop_again: ...@@ -1273,7 +1273,7 @@ loop_again:
total_scanned = 0; total_scanned = 0;
total_reclaimed = 0; total_reclaimed = 0;
sc.gfp_mask = GFP_KERNEL; sc.gfp_mask = GFP_KERNEL;
sc.may_writepage = 0; sc.may_writepage = !laptop_mode;
sc.may_swap = 1; sc.may_swap = 1;
sc.nr_mapped = read_page_state(nr_mapped); sc.nr_mapped = read_page_state(nr_mapped);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment