From 3922349a69bc62dab63d7b5e84e261cb6bc11ee7 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Thu, 15 Nov 2012 13:37:32 +1100 Subject: [PATCH] memcg: remove test for current->mm in memcg_stop/resume_kmem_account The original reason for the existence of this test, was that memcg_kmem_cache_create could be called from either softirq context (where memcg_stop/resume_account is not needed), or process context, (where memcg_stop/resume_account is needed). Just skipping it in-function was the cleanest way to merge both behaviors. The reason for that is that we would try to create caches right away through memcg_kmem_cache_create if the context would allow us to. However, the final version of the code that merged did not have this behavior and we always queue up new cache creation. Thus, instead of a comment explaining why current->mm test is needed, my proposal in this patch is to remove memcg_stop/resume_account from the worker thread and make sure all callers have a valid mm context. Signed-off-by: Glauber Costa Cc: Michal Hocko Cc: Kamezawa Hiroyuki Cc: Johannes Weiner Acked-by: David Rientjes Signed-off-by: Andrew Morton --- mm/memcontrol.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 79754fdf2449..06bcaf9fc580 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3047,17 +3047,13 @@ out: */ static inline void memcg_stop_kmem_account(void) { - if (!current->mm) - return; - + VM_BUG_ON(!current->mm); current->memcg_kmem_skip_account++; } static inline void memcg_resume_kmem_account(void) { - if (!current->mm) - return; - + VM_BUG_ON(!current->mm); current->memcg_kmem_skip_account--; } @@ -3119,11 +3115,7 @@ static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, if (new_cachep) goto out; - /* Don't block progress to enqueue caches for internal infrastructure */ - memcg_stop_kmem_account(); new_cachep = kmem_cache_dup(memcg, cachep); - memcg_resume_kmem_account(); - if (new_cachep == NULL) { new_cachep = cachep; goto out; -- 2.39.5