diff options
author | Vladimir Davydov <vdavydov@parallels.com> | 2015-02-10 17:11:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-10 17:30:34 -0500 |
commit | dbf22eb6d8675fc173154d9f1bd1bd0fda53a001 (patch) | |
tree | e8a27d3a609de60006258e422d907090d4461032 /mm | |
parent | 4c5018ce06c6be292d4ed96cecf2c8dda361a923 (diff) |
memcg: zap __memcg_{charge,uncharge}_slab
They are simple wrappers around memcg_{charge,uncharge}_kmem, so let's
zap them and call these functions directly.
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 21 | ||||
-rw-r--r-- | mm/slab.h | 4 |
2 files changed, 5 insertions, 20 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8b58701b9647..e229e3ad615c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2495,8 +2495,8 @@ static struct kmem_cache *memcg_params_to_cache(struct memcg_cache_params *p) | |||
2495 | return cache_from_memcg_idx(cachep, memcg_cache_id(p->memcg)); | 2495 | return cache_from_memcg_idx(cachep, memcg_cache_id(p->memcg)); |
2496 | } | 2496 | } |
2497 | 2497 | ||
2498 | static int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp, | 2498 | int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp, |
2499 | unsigned long nr_pages) | 2499 | unsigned long nr_pages) |
2500 | { | 2500 | { |
2501 | struct page_counter *counter; | 2501 | struct page_counter *counter; |
2502 | int ret = 0; | 2502 | int ret = 0; |
@@ -2533,8 +2533,7 @@ static int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp, | |||
2533 | return ret; | 2533 | return ret; |
2534 | } | 2534 | } |
2535 | 2535 | ||
2536 | static void memcg_uncharge_kmem(struct mem_cgroup *memcg, | 2536 | void memcg_uncharge_kmem(struct mem_cgroup *memcg, unsigned long nr_pages) |
2537 | unsigned long nr_pages) | ||
2538 | { | 2537 | { |
2539 | page_counter_uncharge(&memcg->memory, nr_pages); | 2538 | page_counter_uncharge(&memcg->memory, nr_pages); |
2540 | if (do_swap_account) | 2539 | if (do_swap_account) |
@@ -2767,20 +2766,6 @@ static void memcg_schedule_register_cache(struct mem_cgroup *memcg, | |||
2767 | current->memcg_kmem_skip_account = 0; | 2766 | current->memcg_kmem_skip_account = 0; |
2768 | } | 2767 | } |
2769 | 2768 | ||
2770 | int __memcg_charge_slab(struct kmem_cache *cachep, gfp_t gfp, int order) | ||
2771 | { | ||
2772 | unsigned int nr_pages = 1 << order; | ||
2773 | |||
2774 | return memcg_charge_kmem(cachep->memcg_params->memcg, gfp, nr_pages); | ||
2775 | } | ||
2776 | |||
2777 | void __memcg_uncharge_slab(struct kmem_cache *cachep, int order) | ||
2778 | { | ||
2779 | unsigned int nr_pages = 1 << order; | ||
2780 | |||
2781 | memcg_uncharge_kmem(cachep->memcg_params->memcg, nr_pages); | ||
2782 | } | ||
2783 | |||
2784 | /* | 2769 | /* |
2785 | * Return the kmem_cache we're supposed to use for a slab allocation. | 2770 | * Return the kmem_cache we're supposed to use for a slab allocation. |
2786 | * We try to use the current memcg's version of the cache. | 2771 | * We try to use the current memcg's version of the cache. |
@@ -235,7 +235,7 @@ static __always_inline int memcg_charge_slab(struct kmem_cache *s, | |||
235 | return 0; | 235 | return 0; |
236 | if (is_root_cache(s)) | 236 | if (is_root_cache(s)) |
237 | return 0; | 237 | return 0; |
238 | return __memcg_charge_slab(s, gfp, order); | 238 | return memcg_charge_kmem(s->memcg_params->memcg, gfp, 1 << order); |
239 | } | 239 | } |
240 | 240 | ||
241 | static __always_inline void memcg_uncharge_slab(struct kmem_cache *s, int order) | 241 | static __always_inline void memcg_uncharge_slab(struct kmem_cache *s, int order) |
@@ -244,7 +244,7 @@ static __always_inline void memcg_uncharge_slab(struct kmem_cache *s, int order) | |||
244 | return; | 244 | return; |
245 | if (is_root_cache(s)) | 245 | if (is_root_cache(s)) |
246 | return; | 246 | return; |
247 | __memcg_uncharge_slab(s, order); | 247 | memcg_uncharge_kmem(s->memcg_params->memcg, 1 << order); |
248 | } | 248 | } |
249 | #else | 249 | #else |
250 | static inline bool is_root_cache(struct kmem_cache *s) | 250 | static inline bool is_root_cache(struct kmem_cache *s) |