aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2009-03-31 18:19:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:11 -0400
commita6dc60f8975ad96d162915e07703a4439c80dcf0 (patch)
treeb28cae1e69e85e87d6991dbbb199bfe73fb433af /mm/vmscan.c
parent9de1581e75ba9d7979766d4ab6d56f0f2d87f7c6 (diff)
vmscan: rename sc.may_swap to may_unmap
sc.may_swap does not only influence reclaiming of anon pages but pages mapped into pagetables in general, which also includes mapped file pages. In shrink_page_list(): if (!sc->may_swap && page_mapped(page)) goto keep_locked; For anon pages, this makes sense as they are always mapped and reclaiming them always requires swapping. But mapped file pages are skipped here as well and it has nothing to do with swapping. The real effect of the knob is whether mapped pages are unmapped and reclaimed or not. Rename it to `may_unmap' to have its name match its actual meaning more precisely. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: MinChan Kim <minchan.kim@gmail.com> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Lee Schermerhorn <lee.schermerhorn@hp.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 479e46719394..1bca60f0c527 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -60,8 +60,8 @@ struct scan_control {
60 60
61 int may_writepage; 61 int may_writepage;
62 62
63 /* Can pages be swapped as part of reclaim? */ 63 /* Can mapped pages be reclaimed? */
64 int may_swap; 64 int may_unmap;
65 65
66 /* This context's SWAP_CLUSTER_MAX. If freeing memory for 66 /* This context's SWAP_CLUSTER_MAX. If freeing memory for
67 * suspend, we effectively ignore SWAP_CLUSTER_MAX. 67 * suspend, we effectively ignore SWAP_CLUSTER_MAX.
@@ -606,7 +606,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
606 if (unlikely(!page_evictable(page, NULL))) 606 if (unlikely(!page_evictable(page, NULL)))
607 goto cull_mlocked; 607 goto cull_mlocked;
608 608
609 if (!sc->may_swap && page_mapped(page)) 609 if (!sc->may_unmap && page_mapped(page))
610 goto keep_locked; 610 goto keep_locked;
611 611
612 /* Double the slab pressure for mapped and swapcache pages */ 612 /* Double the slab pressure for mapped and swapcache pages */
@@ -1694,7 +1694,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
1694 .gfp_mask = gfp_mask, 1694 .gfp_mask = gfp_mask,
1695 .may_writepage = !laptop_mode, 1695 .may_writepage = !laptop_mode,
1696 .swap_cluster_max = SWAP_CLUSTER_MAX, 1696 .swap_cluster_max = SWAP_CLUSTER_MAX,
1697 .may_swap = 1, 1697 .may_unmap = 1,
1698 .swappiness = vm_swappiness, 1698 .swappiness = vm_swappiness,
1699 .order = order, 1699 .order = order,
1700 .mem_cgroup = NULL, 1700 .mem_cgroup = NULL,
@@ -1713,7 +1713,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
1713{ 1713{
1714 struct scan_control sc = { 1714 struct scan_control sc = {
1715 .may_writepage = !laptop_mode, 1715 .may_writepage = !laptop_mode,
1716 .may_swap = 1, 1716 .may_unmap = 1,
1717 .swap_cluster_max = SWAP_CLUSTER_MAX, 1717 .swap_cluster_max = SWAP_CLUSTER_MAX,
1718 .swappiness = swappiness, 1718 .swappiness = swappiness,
1719 .order = 0, 1719 .order = 0,
@@ -1723,7 +1723,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
1723 struct zonelist *zonelist; 1723 struct zonelist *zonelist;
1724 1724
1725 if (noswap) 1725 if (noswap)
1726 sc.may_swap = 0; 1726 sc.may_unmap = 0;
1727 1727
1728 sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | 1728 sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
1729 (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); 1729 (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK);
@@ -1762,7 +1762,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
1762 struct reclaim_state *reclaim_state = current->reclaim_state; 1762 struct reclaim_state *reclaim_state = current->reclaim_state;
1763 struct scan_control sc = { 1763 struct scan_control sc = {
1764 .gfp_mask = GFP_KERNEL, 1764 .gfp_mask = GFP_KERNEL,
1765 .may_swap = 1, 1765 .may_unmap = 1,
1766 .swap_cluster_max = SWAP_CLUSTER_MAX, 1766 .swap_cluster_max = SWAP_CLUSTER_MAX,
1767 .swappiness = vm_swappiness, 1767 .swappiness = vm_swappiness,
1768 .order = order, 1768 .order = order,
@@ -2110,7 +2110,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
2110 struct reclaim_state reclaim_state; 2110 struct reclaim_state reclaim_state;
2111 struct scan_control sc = { 2111 struct scan_control sc = {
2112 .gfp_mask = GFP_KERNEL, 2112 .gfp_mask = GFP_KERNEL,
2113 .may_swap = 0, 2113 .may_unmap = 0,
2114 .swap_cluster_max = nr_pages, 2114 .swap_cluster_max = nr_pages,
2115 .may_writepage = 1, 2115 .may_writepage = 1,
2116 .isolate_pages = isolate_pages_global, 2116 .isolate_pages = isolate_pages_global,
@@ -2147,7 +2147,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
2147 2147
2148 /* Force reclaiming mapped pages in the passes #3 and #4 */ 2148 /* Force reclaiming mapped pages in the passes #3 and #4 */
2149 if (pass > 2) 2149 if (pass > 2)
2150 sc.may_swap = 1; 2150 sc.may_unmap = 1;
2151 2151
2152 for (prio = DEF_PRIORITY; prio >= 0; prio--) { 2152 for (prio = DEF_PRIORITY; prio >= 0; prio--) {
2153 unsigned long nr_to_scan = nr_pages - ret; 2153 unsigned long nr_to_scan = nr_pages - ret;
@@ -2290,7 +2290,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
2290 int priority; 2290 int priority;
2291 struct scan_control sc = { 2291 struct scan_control sc = {
2292 .may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE), 2292 .may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),
2293 .may_swap = !!(zone_reclaim_mode & RECLAIM_SWAP), 2293 .may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),
2294 .swap_cluster_max = max_t(unsigned long, nr_pages, 2294 .swap_cluster_max = max_t(unsigned long, nr_pages,
2295 SWAP_CLUSTER_MAX), 2295 SWAP_CLUSTER_MAX),
2296 .gfp_mask = gfp_mask, 2296 .gfp_mask = gfp_mask,