]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
memcg: slub: fix SUnreclaim for post charged objects
authorShakeel Butt <shakeel.butt@linux.dev>
Tue, 10 Dec 2024 04:06:57 +0000 (20:06 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2024 17:13:01 +0000 (18:13 +0100)
commit825bccd94343a59eaeacacfa1c8bb3ae7d625fb1
tree07911cee18615691d07ac6dcb119546760a89b3d
parent6e564f2ae92414f506a7e92fca529b8f1c18211c
memcg: slub: fix SUnreclaim for post charged objects

commit b7ffecbe198e2dfc44abf92ceb90f46150f7527a upstream.

Large kmalloc directly allocates from the page allocator and then use
lruvec_stat_mod_folio() to increment the unreclaimable slab stats for
global and memcg. However when post memcg charging of slab objects was
added in commit 9028cdeb38e1 ("memcg: add charging of already allocated
slab objects"), it missed to correctly handle the unreclaimable slab
stats for memcg.

One user visisble effect of that bug is that the node level
unreclaimable slab stat will work correctly but the memcg level stat can
underflow as kernel correctly handles the free path but the charge path
missed to increment the memcg level unreclaimable slab stat. Let's fix
by correctly handle in the post charge code path.

Fixes: 9028cdeb38e1 ("memcg: add charging of already allocated slab objects")
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: <stable@vger.kernel.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/slub.c