diff options
author | Vladimir Davydov <vdavydov@virtuozzo.com> | 2016-03-17 17:18:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 18:09:34 -0400 |
commit | b6ecd2dea4435a771a99c497a6ac5df6d3618c5a (patch) | |
tree | 8787f8b4e131337d729eadf89e01057e0f8f3f49 /mm/memcontrol.c | |
parent | 0fc9f58a90a5012942abf0ae98cfc852afebc0a6 (diff) |
mm: memcontrol: zap memcg_kmem_online helper
As kmem accounting is now either enabled for all cgroups or disabled
system-wide, there's no point in having memcg_kmem_online() helper -
instead one can use memcg_kmem_enabled() and mem_cgroup_online(), as
shrink_slab() now does.
There are only two places left where this helper is used -
__memcg_kmem_charge() and memcg_create_kmem_cache(). The former can
only be called if memcg_kmem_enabled() returned true. Since the cgroup
it operates on is online, mem_cgroup_is_root() check will be enough.
memcg_create_kmem_cache() can't use mem_cgroup_online() helper instead
of memcg_kmem_online(), because it relies on the fact that in
memcg_offline_kmem() memcg->kmem_state is changed before
memcg_deactivate_kmem_caches() is called, but there we can just
open-code the check.
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@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 | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 28d1b1e9d4fb..341bf86d26c2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2346,7 +2346,7 @@ int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order) | |||
2346 | int ret = 0; | 2346 | int ret = 0; |
2347 | 2347 | ||
2348 | memcg = get_mem_cgroup_from_mm(current->mm); | 2348 | memcg = get_mem_cgroup_from_mm(current->mm); |
2349 | if (memcg_kmem_online(memcg)) | 2349 | if (!mem_cgroup_is_root(memcg)) |
2350 | ret = __memcg_kmem_charge_memcg(page, gfp, order, memcg); | 2350 | ret = __memcg_kmem_charge_memcg(page, gfp, order, memcg); |
2351 | css_put(&memcg->css); | 2351 | css_put(&memcg->css); |
2352 | return ret; | 2352 | return ret; |