]> Git Repo - linux.git/commit
mm: memcg/slab: stop setting page->mem_cgroup pointer for slab pages
authorRoman Gushchin <[email protected]>
Fri, 12 Jul 2019 03:56:31 +0000 (20:56 -0700)
committerLinus Torvalds <[email protected]>
Fri, 12 Jul 2019 18:05:44 +0000 (11:05 -0700)
commit4d96ba3530750fae3f3f01150adfecde96157815
tree07ecb2d8f21bff7471ed9fd5c46b4a45fa6dcf5b
parentf0a3a24b532d9a7e56a33c5112b2a212ed6ec580
mm: memcg/slab: stop setting page->mem_cgroup pointer for slab pages

Every slab page charged to a non-root memory cgroup has a pointer to the
memory cgroup and holds a reference to it, which protects a non-empty
memory cgroup from being released.  At the same time the page has a
pointer to the corresponding kmem_cache, and also hold a reference to the
kmem_cache.  And kmem_cache by itself holds a reference to the cgroup.

So there is clearly some redundancy, which allows to stop setting the
page->mem_cgroup pointer and rely on getting memcg pointer indirectly via
kmem_cache.  Further it will allow to change this pointer easier, without
a need to go over all charged pages.

So let's stop setting page->mem_cgroup pointer for slab pages, and stop
using the css refcounter directly for protecting the memory cgroup from
going away.  Instead rely on kmem_cache as an intermediate object.

Make sure that vmstats and shrinker lists are working as previously, as
well as /proc/kpagecgroup interface.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Roman Gushchin <[email protected]>
Acked-by: Vladimir Davydov <[email protected]>
Reviewed-by: Shakeel Butt <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Andrei Vagin <[email protected]>
Cc: Qian Cai <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/list_lru.c
mm/memcontrol.c
mm/slab.h
This page took 0.053757 seconds and 4 git commands to generate.