Commit 1a93be0e authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Linus Torvalds

mm/vmscan: push lruvec pointer into shrink_list()

Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: default avatarHugh Dickins <hughd@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c56d5c7d
...@@ -1205,7 +1205,7 @@ putback_inactive_pages(struct lruvec *lruvec, ...@@ -1205,7 +1205,7 @@ putback_inactive_pages(struct lruvec *lruvec,
* of reclaimed pages * of reclaimed pages
*/ */
static noinline_for_stack unsigned long static noinline_for_stack unsigned long
shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz, shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
struct scan_control *sc, enum lru_list lru) struct scan_control *sc, enum lru_list lru)
{ {
LIST_HEAD(page_list); LIST_HEAD(page_list);
...@@ -1216,9 +1216,8 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz, ...@@ -1216,9 +1216,8 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
unsigned long nr_writeback = 0; unsigned long nr_writeback = 0;
isolate_mode_t isolate_mode = 0; isolate_mode_t isolate_mode = 0;
int file = is_file_lru(lru); int file = is_file_lru(lru);
struct zone *zone = mz->zone; struct zone *zone = lruvec_zone(lruvec);
struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz); struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, mz->mem_cgroup);
while (unlikely(too_many_isolated(zone, file, sc))) { while (unlikely(too_many_isolated(zone, file, sc))) {
congestion_wait(BLK_RW_ASYNC, HZ/10); congestion_wait(BLK_RW_ASYNC, HZ/10);
...@@ -1373,7 +1372,7 @@ static void move_active_pages_to_lru(struct zone *zone, ...@@ -1373,7 +1372,7 @@ static void move_active_pages_to_lru(struct zone *zone,
} }
static void shrink_active_list(unsigned long nr_to_scan, static void shrink_active_list(unsigned long nr_to_scan,
struct mem_cgroup_zone *mz, struct lruvec *lruvec,
struct scan_control *sc, struct scan_control *sc,
enum lru_list lru) enum lru_list lru)
{ {
...@@ -1384,12 +1383,11 @@ static void shrink_active_list(unsigned long nr_to_scan, ...@@ -1384,12 +1383,11 @@ static void shrink_active_list(unsigned long nr_to_scan,
LIST_HEAD(l_active); LIST_HEAD(l_active);
LIST_HEAD(l_inactive); LIST_HEAD(l_inactive);
struct page *page; struct page *page;
struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz); struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
unsigned long nr_rotated = 0; unsigned long nr_rotated = 0;
isolate_mode_t isolate_mode = 0; isolate_mode_t isolate_mode = 0;
int file = is_file_lru(lru); int file = is_file_lru(lru);
struct zone *zone = mz->zone; struct zone *zone = lruvec_zone(lruvec);
struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, mz->mem_cgroup);
lru_add_drain(); lru_add_drain();
...@@ -1555,21 +1553,17 @@ static int inactive_list_is_low(struct lruvec *lruvec, int file) ...@@ -1555,21 +1553,17 @@ static int inactive_list_is_low(struct lruvec *lruvec, int file)
} }
static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
struct mem_cgroup_zone *mz, struct lruvec *lruvec, struct scan_control *sc)
struct scan_control *sc)
{ {
int file = is_file_lru(lru); int file = is_file_lru(lru);
if (is_active_lru(lru)) { if (is_active_lru(lru)) {
struct lruvec *lruvec = mem_cgroup_zone_lruvec(mz->zone,
mz->mem_cgroup);
if (inactive_list_is_low(lruvec, file)) if (inactive_list_is_low(lruvec, file))
shrink_active_list(nr_to_scan, mz, sc, lru); shrink_active_list(nr_to_scan, lruvec, sc, lru);
return 0; return 0;
} }
return shrink_inactive_list(nr_to_scan, mz, sc, lru); return shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
} }
static int vmscan_swappiness(struct scan_control *sc) static int vmscan_swappiness(struct scan_control *sc)
...@@ -1812,7 +1806,7 @@ static void shrink_mem_cgroup_zone(struct mem_cgroup_zone *mz, ...@@ -1812,7 +1806,7 @@ static void shrink_mem_cgroup_zone(struct mem_cgroup_zone *mz,
nr[lru] -= nr_to_scan; nr[lru] -= nr_to_scan;
nr_reclaimed += shrink_list(lru, nr_to_scan, nr_reclaimed += shrink_list(lru, nr_to_scan,
mz, sc); lruvec, sc);
} }
} }
/* /*
...@@ -1835,7 +1829,7 @@ static void shrink_mem_cgroup_zone(struct mem_cgroup_zone *mz, ...@@ -1835,7 +1829,7 @@ static void shrink_mem_cgroup_zone(struct mem_cgroup_zone *mz,
* rebalance the anon lru active/inactive ratio. * rebalance the anon lru active/inactive ratio.
*/ */
if (inactive_anon_is_low(lruvec)) if (inactive_anon_is_low(lruvec))
shrink_active_list(SWAP_CLUSTER_MAX, mz, shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
sc, LRU_ACTIVE_ANON); sc, LRU_ACTIVE_ANON);
/* reclaim/compaction might need reclaim to continue */ /* reclaim/compaction might need reclaim to continue */
...@@ -2268,13 +2262,9 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc) ...@@ -2268,13 +2262,9 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc)
memcg = mem_cgroup_iter(NULL, NULL, NULL); memcg = mem_cgroup_iter(NULL, NULL, NULL);
do { do {
struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg); struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
struct mem_cgroup_zone mz = {
.mem_cgroup = memcg,
.zone = zone,
};
if (inactive_anon_is_low(lruvec)) if (inactive_anon_is_low(lruvec))
shrink_active_list(SWAP_CLUSTER_MAX, &mz, shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
sc, LRU_ACTIVE_ANON); sc, LRU_ACTIVE_ANON);
memcg = mem_cgroup_iter(NULL, memcg, NULL); memcg = mem_cgroup_iter(NULL, memcg, NULL);
......
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