]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
memcg: remove test for current->mm in memcg_stop/resume_kmem_account
authorGlauber Costa <glommer@parallels.com>
Thu, 15 Nov 2012 02:37:32 +0000 (13:37 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 15 Nov 2012 06:25:38 +0000 (17:25 +1100)
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 <glommer@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol.c

index 79754fdf24490fa049edf6fc28408b569707b6e1..06bcaf9fc5809bdea22adcfccecde8ee78993309 100644 (file)
@@ -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;