Commit f1fd1067 authored by Christoph Lameter's avatar Christoph Lameter Committed by Linus Torvalds

[PATCH] Zone reclaim: resurrect may_swap

Zone reclaim has a huge impact on NUMA performance (f.e.  our maximum
throughput with XFS is raised from 4GB to 6GB/sec / page cache contamination
of numa nodes destroys locality if one just does a large copy operation which
results in performance dropping for good until reboot).

This patch:

Resurrect may_swap in struct scan_control
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 fc301289
...@@ -71,6 +71,9 @@ struct scan_control { ...@@ -71,6 +71,9 @@ struct scan_control {
int may_writepage; int may_writepage;
/* Can pages be swapped as part of reclaim? */
int may_swap;
/* This context's SWAP_CLUSTER_MAX. If freeing memory for /* This context's SWAP_CLUSTER_MAX. If freeing memory for
* suspend, we effectively ignore SWAP_CLUSTER_MAX. * suspend, we effectively ignore SWAP_CLUSTER_MAX.
* In this context, it doesn't matter that we scan the * In this context, it doesn't matter that we scan the
...@@ -458,6 +461,8 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) ...@@ -458,6 +461,8 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
* Try to allocate it some swap space here. * Try to allocate it some swap space here.
*/ */
if (PageAnon(page) && !PageSwapCache(page)) { if (PageAnon(page) && !PageSwapCache(page)) {
if (!sc->may_swap)
goto keep_locked;
if (!add_to_swap(page, GFP_ATOMIC)) if (!add_to_swap(page, GFP_ATOMIC))
goto activate_locked; goto activate_locked;
} }
...@@ -1166,6 +1171,7 @@ int try_to_free_pages(struct zone **zones, gfp_t gfp_mask) ...@@ -1166,6 +1171,7 @@ int try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
sc.gfp_mask = gfp_mask; sc.gfp_mask = gfp_mask;
sc.may_writepage = 0; sc.may_writepage = 0;
sc.may_swap = 1;
inc_page_state(allocstall); inc_page_state(allocstall);
...@@ -1268,6 +1274,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, int order) ...@@ -1268,6 +1274,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, int order)
total_reclaimed = 0; total_reclaimed = 0;
sc.gfp_mask = GFP_KERNEL; sc.gfp_mask = GFP_KERNEL;
sc.may_writepage = 0; sc.may_writepage = 0;
sc.may_swap = 1;
sc.nr_mapped = read_page_state(nr_mapped); sc.nr_mapped = read_page_state(nr_mapped);
inc_page_state(pageoutrun); inc_page_state(pageoutrun);
......
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