From: Christoph Lameter Resurrect may_swap in struct scan_control Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton --- mm/vmscan.c | 7 +++++++ 1 files changed, 7 insertions(+) diff -puN mm/vmscan.c~zone-reclaim-resurrect-may_swap mm/vmscan.c --- 25/mm/vmscan.c~zone-reclaim-resurrect-may_swap Tue Jan 10 15:59:36 2006 +++ 25-akpm/mm/vmscan.c Tue Jan 10 15:59:36 2006 @@ -71,6 +71,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 @@ -458,6 +461,8 @@ static int shrink_list(struct list_head * Try to allocate it some swap space here. */ if (PageAnon(page) && !PageSwapCache(page)) { + if (!sc->may_swap) + goto keep_locked; if (!add_to_swap(page, GFP_ATOMIC)) goto activate_locked; } @@ -1177,6 +1182,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); @@ -1279,6 +1285,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); _