aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2012-05-29 18:06:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:26 -0400
commit3d58ab5c97fa2d145050242137ac39ca7d3bc2fc (patch)
treee9d11fc9ababf9eafcb54cc60facd793eeafaf74 /mm
parent748dad36d645f5c4517a115d60bb3a0e8f877ac0 (diff)
mm/memcg: use vm_swappiness from target memory cgroup
Use vm_swappiness from memory cgroup which is triggered this memory reclaim. This is more reasonable and allows to kill one argument. [akpm@linux-foundation.org: fix build (patch skew)] Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtisu.com> Cc: Hugh Dickins <hughd@google.com> Cc: Glauber Costa <glommer@parallels.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmscan.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index c94d17d75d73..0e2131deb2d3 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1622,12 +1622,11 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
1622 return shrink_inactive_list(nr_to_scan, mz, sc, priority, lru); 1622 return shrink_inactive_list(nr_to_scan, mz, sc, priority, lru);
1623} 1623}
1624 1624
1625static int vmscan_swappiness(struct mem_cgroup_zone *mz, 1625static int vmscan_swappiness(struct scan_control *sc)
1626 struct scan_control *sc)
1627{ 1626{
1628 if (global_reclaim(sc)) 1627 if (global_reclaim(sc))
1629 return vm_swappiness; 1628 return vm_swappiness;
1630 return mem_cgroup_swappiness(mz->mem_cgroup); 1629 return mem_cgroup_swappiness(sc->target_mem_cgroup);
1631} 1630}
1632 1631
1633/* 1632/*
@@ -1695,8 +1694,8 @@ static void get_scan_count(struct mem_cgroup_zone *mz, struct scan_control *sc,
1695 * With swappiness at 100, anonymous and file have the same priority. 1694 * With swappiness at 100, anonymous and file have the same priority.
1696 * This scanning priority is essentially the inverse of IO cost. 1695 * This scanning priority is essentially the inverse of IO cost.
1697 */ 1696 */
1698 anon_prio = vmscan_swappiness(mz, sc); 1697 anon_prio = vmscan_swappiness(sc);
1699 file_prio = 200 - vmscan_swappiness(mz, sc); 1698 file_prio = 200 - vmscan_swappiness(sc);
1700 1699
1701 /* 1700 /*
1702 * OK, so we have swap space and a fair amount of page cache 1701 * OK, so we have swap space and a fair amount of page cache
@@ -1741,7 +1740,7 @@ out:
1741 unsigned long scan; 1740 unsigned long scan;
1742 1741
1743 scan = zone_nr_lru_pages(mz, lru); 1742 scan = zone_nr_lru_pages(mz, lru);
1744 if (priority || noswap || !vmscan_swappiness(mz, sc)) { 1743 if (priority || noswap || !vmscan_swappiness(sc)) {
1745 scan >>= priority; 1744 scan >>= priority;
1746 if (!scan && force_scan) 1745 if (!scan && force_scan)
1747 scan = SWAP_CLUSTER_MAX; 1746 scan = SWAP_CLUSTER_MAX;