diff options
author | Vladimir Davydov <vdavydov@parallels.com> | 2015-02-11 18:25:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-11 20:06:02 -0500 |
commit | 90cbc2508827e1e15dca23361c33cc26dd2b9e99 (patch) | |
tree | 2506a694871a0b916c60990b945b883a334791d5 /mm/memcontrol.c | |
parent | 81422f29c5f4fb968023f465218c3d978c133ceb (diff) |
vmscan: force scan offline memory cgroups
Since commit b2052564e66d ("mm: memcontrol: continue cache reclaim from
offlined groups") pages charged to a memory cgroup are not reparented when
the cgroup is removed. Instead, they are supposed to be reclaimed in a
regular way, along with pages accounted to online memory cgroups.
However, an lruvec of an offline memory cgroup will sooner or later get so
small that it will be scanned only at low scan priorities (see
get_scan_count()). Therefore, if there are enough reclaimable pages in
big lruvecs, pages accounted to offline memory cgroups will never be
scanned at all, wasting memory.
Fix this by unconditionally forcing scanning dead lruvecs from kswapd.
[akpm@linux-foundation.org: fix build]
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 028d07c79104..6187ca4d5dc2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1367,6 +1367,20 @@ int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec) | |||
1367 | return inactive * inactive_ratio < active; | 1367 | return inactive * inactive_ratio < active; |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | bool mem_cgroup_lruvec_online(struct lruvec *lruvec) | ||
1371 | { | ||
1372 | struct mem_cgroup_per_zone *mz; | ||
1373 | struct mem_cgroup *memcg; | ||
1374 | |||
1375 | if (mem_cgroup_disabled()) | ||
1376 | return true; | ||
1377 | |||
1378 | mz = container_of(lruvec, struct mem_cgroup_per_zone, lruvec); | ||
1379 | memcg = mz->memcg; | ||
1380 | |||
1381 | return !!(memcg->css.flags & CSS_ONLINE); | ||
1382 | } | ||
1383 | |||
1370 | #define mem_cgroup_from_counter(counter, member) \ | 1384 | #define mem_cgroup_from_counter(counter, member) \ |
1371 | container_of(counter, struct mem_cgroup, member) | 1385 | container_of(counter, struct mem_cgroup, member) |
1372 | 1386 | ||