aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2012-05-29 18:07:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:27 -0400
commitf9be23d6da035241b7687b25e64401171986dcef (patch)
tree9cdb45dc92785d18cbe6989abf8bf958618f28c8 /mm/vmscan.c
parent90bdcfafdc660b359018262f0f8630d100e28760 (diff)
mm/vmscan: kill struct mem_cgroup_zone
Kill struct mem_cgroup_zone and rename shrink_mem_cgroup_zone() to shrink_lruvec(), it always shrinks one lruvec which it takes as an argument. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Mel Gorman <mel@csn.ul.ie> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Hugh Dickins <hughd@google.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.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1d251b5b0a06..4c5453f8427d 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -94,11 +94,6 @@ struct scan_control {
94 nodemask_t *nodemask; 94 nodemask_t *nodemask;
95}; 95};
96 96
97struct mem_cgroup_zone {
98 struct mem_cgroup *mem_cgroup;
99 struct zone *zone;
100};
101
102#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru)) 97#define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
103 98
104#ifdef ARCH_HAS_PREFETCH 99#ifdef ARCH_HAS_PREFETCH
@@ -1769,8 +1764,7 @@ static inline bool should_continue_reclaim(struct lruvec *lruvec,
1769/* 1764/*
1770 * This is a basic per-zone page freer. Used by both kswapd and direct reclaim. 1765 * This is a basic per-zone page freer. Used by both kswapd and direct reclaim.
1771 */ 1766 */
1772static void shrink_mem_cgroup_zone(struct mem_cgroup_zone *mz, 1767static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
1773 struct scan_control *sc)
1774{ 1768{
1775 unsigned long nr[NR_LRU_LISTS]; 1769 unsigned long nr[NR_LRU_LISTS];
1776 unsigned long nr_to_scan; 1770 unsigned long nr_to_scan;
@@ -1778,9 +1772,6 @@ static void shrink_mem_cgroup_zone(struct mem_cgroup_zone *mz,
1778 unsigned long nr_reclaimed, nr_scanned; 1772 unsigned long nr_reclaimed, nr_scanned;
1779 unsigned long nr_to_reclaim = sc->nr_to_reclaim; 1773 unsigned long nr_to_reclaim = sc->nr_to_reclaim;
1780 struct blk_plug plug; 1774 struct blk_plug plug;
1781 struct lruvec *lruvec;
1782
1783 lruvec = mem_cgroup_zone_lruvec(mz->zone, mz->mem_cgroup);
1784 1775
1785restart: 1776restart:
1786 nr_reclaimed = 0; 1777 nr_reclaimed = 0;
@@ -1842,12 +1833,10 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc)
1842 1833
1843 memcg = mem_cgroup_iter(root, NULL, &reclaim); 1834 memcg = mem_cgroup_iter(root, NULL, &reclaim);
1844 do { 1835 do {
1845 struct mem_cgroup_zone mz = { 1836 struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
1846 .mem_cgroup = memcg, 1837
1847 .zone = zone, 1838 shrink_lruvec(lruvec, sc);
1848 };
1849 1839
1850 shrink_mem_cgroup_zone(&mz, sc);
1851 /* 1840 /*
1852 * Limit reclaim has historically picked one memcg and 1841 * Limit reclaim has historically picked one memcg and
1853 * scanned it with decreasing priority levels until 1842 * scanned it with decreasing priority levels until
@@ -2172,10 +2161,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *memcg,
2172 .priority = 0, 2161 .priority = 0,
2173 .target_mem_cgroup = memcg, 2162 .target_mem_cgroup = memcg,
2174 }; 2163 };
2175 struct mem_cgroup_zone mz = { 2164 struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
2176 .mem_cgroup = memcg,
2177 .zone = zone,
2178 };
2179 2165
2180 sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | 2166 sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
2181 (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); 2167 (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK);
@@ -2191,7 +2177,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *memcg,
2191 * will pick up pages from other mem cgroup's as well. We hack 2177 * will pick up pages from other mem cgroup's as well. We hack
2192 * the priority and make it zero. 2178 * the priority and make it zero.
2193 */ 2179 */
2194 shrink_mem_cgroup_zone(&mz, &sc); 2180 shrink_lruvec(lruvec, &sc);
2195 2181
2196 trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed); 2182 trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed);
2197 2183