Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

slab: do not panic if we fail to create memcg cache

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>

authored by

Vladimir Davydov and committed by
Linus Torvalds
f717eb3a 842e2873

+8 -1
+8 -1
mm/slab_common.c
··· 233 233 mutex_unlock(&slab_mutex); 234 234 put_online_cpus(); 235 235 236 - if (err) { 236 + /* 237 + * There is no point in flooding logs with warnings or especially 238 + * crashing the system if we fail to create a cache for a memcg. In 239 + * this case we will be accounting the memcg allocation to the root 240 + * cgroup until we succeed to create its own cache, but it isn't that 241 + * critical. 242 + */ 243 + if (err && !memcg) { 237 244 if (flags & SLAB_PANIC) 238 245 panic("kmem_cache_create: Failed to create slab '%s'. Error %d\n", 239 246 name, err);