]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - mm/slab.c
mm, slab: memcg_link the SLAB's kmem_cache
authorShakeel Butt <shakeelb@google.com>
Wed, 28 Mar 2018 23:00:57 +0000 (16:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 28 Mar 2018 23:42:05 +0000 (13:42 -1000)
commit880cd276dff17ea29e9a8404275c9502b265afa7
tree535ad8d555b7ef5ed33f8dc9fdb73ec50d53ed54
parent3eb2ce825ea1ad89d20f7a3b5780df850e4be274
mm, slab: memcg_link the SLAB's kmem_cache

All the root caches are linked into slab_root_caches which was
introduced by the commit 510ded33e075 ("slab: implement slab_root_caches
list") but it missed to add the SLAB's kmem_cache.

While experimenting with opt-in/opt-out kmem accounting, I noticed
system crashes due to NULL dereference inside cache_from_memcg_idx()
while deferencing kmem_cache.memcg_params.memcg_caches.  The upstream
clean kernel will not see these crashes but SLAB should be consistent
with SLUB which does linked its boot caches (kmem_cache_node and
kmem_cache) into slab_root_caches.

Link: http://lkml.kernel.org/r/20180319210020.60289-1-shakeelb@google.com
Fixes: 510ded33e075c ("slab: implement slab_root_caches list")
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab.c