diff options
| author | Vladimir Davydov <vdavydov@parallels.com> | 2014-04-07 18:39:24 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:36:12 -0400 |
| commit | 5722d094ad2b56fa2c1cb3adaf40071a55bbf242 (patch) | |
| tree | fbae9cdc8bf4d92d2ac268cf761b5f25c5ad6ef9 /include/linux | |
| parent | a44cb9449182fd7b25bf5f1cc38b7f19e0b96f6d (diff) | |
memcg, slab: cleanup memcg cache creation
This patch cleans up the memcg cache creation path as follows:
- Move memcg cache name creation to a separate function to be called
from kmem_cache_create_memcg(). This allows us to get rid of the mutex
protecting the temporary buffer used for the name formatting, because
the whole cache creation path is protected by the slab_mutex.
- Get rid of memcg_create_kmem_cache(). This function serves as a proxy
to kmem_cache_create_memcg(). After separating the cache name creation
path, it would be reduced to a function call, so let's inline it.
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Glauber Costa <glommer@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/memcontrol.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 96f3fc87ab96..ab7f02884983 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -491,6 +491,9 @@ void __memcg_kmem_commit_charge(struct page *page, | |||
| 491 | void __memcg_kmem_uncharge_pages(struct page *page, int order); | 491 | void __memcg_kmem_uncharge_pages(struct page *page, int order); |
| 492 | 492 | ||
| 493 | int memcg_cache_id(struct mem_cgroup *memcg); | 493 | int memcg_cache_id(struct mem_cgroup *memcg); |
| 494 | |||
| 495 | char *memcg_create_cache_name(struct mem_cgroup *memcg, | ||
| 496 | struct kmem_cache *root_cache); | ||
| 494 | int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s, | 497 | int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s, |
| 495 | struct kmem_cache *root_cache); | 498 | struct kmem_cache *root_cache); |
| 496 | void memcg_free_cache_params(struct kmem_cache *s); | 499 | void memcg_free_cache_params(struct kmem_cache *s); |
| @@ -635,6 +638,12 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) | |||
| 635 | return -1; | 638 | return -1; |
| 636 | } | 639 | } |
| 637 | 640 | ||
| 641 | static inline char *memcg_create_cache_name(struct mem_cgroup *memcg, | ||
| 642 | struct kmem_cache *root_cache) | ||
| 643 | { | ||
| 644 | return NULL; | ||
| 645 | } | ||
| 646 | |||
| 638 | static inline int memcg_alloc_cache_params(struct mem_cgroup *memcg, | 647 | static inline int memcg_alloc_cache_params(struct mem_cgroup *memcg, |
| 639 | struct kmem_cache *s, struct kmem_cache *root_cache) | 648 | struct kmem_cache *s, struct kmem_cache *root_cache) |
| 640 | { | 649 | { |
