slab: do not panic if we fail to create memcg cache
authorVladimir Davydov <vdavydov@parallels.com>
Thu, 23 Jan 2014 23:53:05 +0000 (15:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Jan 2014 00:36:51 +0000 (16:36 -0800)
There is no point in flooding logs with warnings or especially crashing
the system if we fail to create a cache for a memcg.  In this case we
will be accounting the memcg allocation to the root cgroup until we
succeed to create its own cache, but it isn't that critical.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Glauber Costa <glommer@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab_common.c

index f34707eeacc7b533a958a44a97e01ab0a9dc5f1e..8e40321da091b66f24f983b266acb344ce41d56c 100644 (file)
@@ -233,7 +233,14 @@ out_unlock:
        mutex_unlock(&slab_mutex);
        put_online_cpus();
 
-       if (err) {
+       /*
+        * There is no point in flooding logs with warnings or especially
+        * crashing the system if we fail to create a cache for a memcg. In
+        * this case we will be accounting the memcg allocation to the root
+        * cgroup until we succeed to create its own cache, but it isn't that
+        * critical.
+        */
+       if (err && !memcg) {
                if (flags & SLAB_PANIC)
                        panic("kmem_cache_create: Failed to create slab '%s'. Error %d\n",
                                name, err);