Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1330253
| From | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 3/6] mm: memcontrol: zap memcg_kmem_online helper |
| Date | 2016-02-09 15:00 +0100 |
| Message-ID | <r0gZK-4N6-39@gated-at.bofh.it> (permalink) |
| References | <r0gZH-4N6-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
include/linux/memcontrol.h | 10 ----------
mm/memcontrol.c | 2 +-
mm/slab_common.c | 2 +-
3 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d6300313b298..bc8e4e22f58f 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -795,11 +795,6 @@ static inline bool memcg_kmem_enabled(void)
return static_branch_unlikely(&memcg_kmem_enabled_key);
}
-static inline bool memcg_kmem_online(struct mem_cgroup *memcg)
-{
- return memcg->kmem_state == KMEM_ONLINE;
-}
-
/*
* In general, we'll do everything in our power to not incur in any overhead
* for non-memcg users for the kmem functions. Not even a function call, if we
@@ -909,11 +904,6 @@ static inline bool memcg_kmem_enabled(void)
return false;
}
-static inline bool memcg_kmem_online(struct mem_cgroup *memcg)
-{
- return false;
-}
-
static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order)
{
return 0;
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)
int ret = 0;
memcg = get_mem_cgroup_from_mm(current->mm);
- if (memcg_kmem_online(memcg))
+ if (!mem_cgroup_is_root(memcg))
ret = __memcg_kmem_charge_memcg(page, gfp, order, memcg);
css_put(&memcg->css);
return ret;
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 6afb2263a5c5..8addc3c4df37 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -510,7 +510,7 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg,
* The memory cgroup could have been offlined while the cache
* creation work was pending.
*/
- if (!memcg_kmem_online(memcg))
+ if (memcg->kmem_state != KMEM_ONLINE)
goto out_unlock;
idx = memcg_cache_id(memcg);
--
2.1.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/6] mm: workingset: make shadow node shrinker memcg aware Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-09 15:00 +0100
[PATCH v2 4/6] radix-tree: account radix_tree_node to memory cgroup Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-09 15:00 +0100
[PATCH v2 5/6] mm: workingset: size shadow nodes lru basing on file cache size Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-09 15:00 +0100
Re: [PATCH v2 5/6] mm: workingset: size shadow nodes lru basing on file cache size Johannes Weiner <hannes@cmpxchg.org> - 2016-02-10 00:20 +0100
[PATCH v2 2/6] mm: vmscan: pass root_mem_cgroup instead of NULL to memcg aware shrinker Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-09 15:00 +0100
[PATCH v2 3/6] mm: memcontrol: zap memcg_kmem_online helper Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-09 15:00 +0100
[PATCH v2 1/6] mm: memcontrol: enable kmem accounting for all cgroups in the legacy hierarchy Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-09 15:00 +0100
csiph-web