Usama Arif and Christian Brauner
0ef8faff49
fs: push nr_cached_objects memcg gating into individual filesystems
...
Commit 0baad6f9b997 ("fs/super: skip non-memcg-aware nr_cached_objects
in memcg slab shrink") added a check in fs/super.c that skipped every
->nr_cached_objects() hook whenever the shrinker was invoked for a
non-root memcg, on the assumption that none of them honour sc->memcg.
That assumption is wrong for XFS, whose inode-reclaim hook is
intentionally driven from per-memcg contexts to free memcg-charged
slab. Encoding a blanket "never memcg-aware" policy in fs/super.c
short-circuits that path.
Push the check down into the callbacks whose counters really are
irrelevant to per-memcg reclaim - btrfs_nr_cached_objects() and
shmem_unused_huge_count() - and drop the fs/super.c gate. Each
filesystem can now lift the restriction independently if its counter
later grows memcg awareness, without touching fs/super.c.
Introduce mem_cgroup_shrink_is_root() in <linux/memcontrol.h> so the
callbacks don't open-code "sc->memcg is NULL or root".
Fixes: 0baad6f9b997 ("fs/super: skip non-memcg-aware nr_cached_objects in memcg slab shrink")
Acked-by: Qi Zheng <qi.zheng@linux.dev >
Reviewed-by: Jan Kara <jack@suse.cz >
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev >
Signed-off-by: Usama Arif <usama.arif@linux.dev >
Link: https://patch.msgid.link/20260715103516.2410175-1-usama.arif@linux.dev
Acked-by: David Sterba <dsterba@suse.com >
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com >
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org >
2026-07-23 11:35:02 +02:00
..
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-16 09:12:24 +02:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:14 +02:00
2026-07-03 07:37:43 +02:00
2026-06-22 12:20:21 -07:00
2026-06-18 08:50:52 -07:00
2026-07-03 07:38:16 +02:00
2026-06-11 10:26:40 +02:00
2026-07-03 07:38:16 +02:00
2026-06-23 15:51:14 -07:00
2026-06-17 11:32:14 +01:00
2026-06-18 08:16:21 -07:00
2026-07-03 07:38:16 +02:00
2026-06-21 17:05:45 +02:00
2026-06-23 08:11:21 +02:00
2026-07-03 07:38:16 +02:00
2026-06-08 10:03:43 +02:00
2026-07-03 07:38:16 +02:00
2026-06-17 12:10:11 +01:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-08 14:07:19 -04:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-06-21 11:31:28 -07:00
2026-07-15 12:13:30 +02:00
2026-06-17 11:21:40 -07:00
2026-06-16 08:53:53 -07:00
2026-07-03 07:38:16 +02:00
2026-06-24 06:53:25 -06:00
2026-06-16 13:02:47 +05:30
2026-06-16 10:07:36 -06:00
2026-06-30 16:31:56 +02:00
2026-06-07 10:03:01 -07:00
2026-06-14 13:47:38 -07:00
2026-06-17 09:18:14 +01:00
2026-06-07 10:03:01 -07:00
2026-07-16 16:11:29 -07:00
2026-06-06 15:08:36 -07:00
2026-06-17 12:03:56 +01:00
2026-06-05 14:46:51 +02:00
2026-06-15 13:51:27 +05:30
2026-06-21 11:31:28 -07:00
2026-06-08 18:21:32 -07:00
2026-06-15 14:21:14 +05:30
2026-06-15 14:21:14 +05:30
2026-06-15 05:01:15 +05:30
2026-06-22 12:20:21 -07:00
2026-07-01 19:02:55 -07:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-06-13 13:24:34 -07:00
2026-07-03 07:38:16 +02:00
2026-06-25 10:18:34 -07:00
2026-06-22 19:52:36 +00:00
2026-06-09 16:00:11 +02:00
2026-06-15 03:59:45 +05:30
2026-07-01 10:33:38 +02:00
2026-07-03 07:38:16 +02:00
2026-06-18 16:39:31 -07:00
2026-07-01 19:02:56 -07:00
2026-06-15 02:50:44 +05:30
2026-06-07 10:03:00 -07:00
2026-07-07 10:42:28 -04:00
2026-06-29 23:24:46 +01:00
2026-07-03 07:38:16 +02:00
2026-06-21 11:37:16 -07:00
2026-06-16 08:10:21 +05:30
2026-07-03 07:38:16 +02:00
2026-06-17 00:15:09 +02:00
2026-07-03 07:38:16 +02:00
2026-07-06 14:11:09 +02:00
2026-06-08 08:59:03 +02:00
2026-06-05 17:46:17 -07:00
2026-07-08 14:41:01 +02:00
2026-07-03 07:38:16 +02:00
2026-06-15 02:13:01 +03:00
2026-07-03 07:38:16 +02:00
2026-06-06 19:51:14 -05:00
2026-06-16 09:48:00 -06:00
2026-07-01 15:26:47 +02:00
2026-06-17 12:33:23 -07:00
2026-06-23 12:08:51 -05:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-06-10 10:42:55 -04:00
2026-06-15 16:33:40 +02:00
2026-06-06 15:21:40 +02:00
2026-06-16 00:39:57 +02:00
2026-06-17 11:28:52 +01:00
2026-06-08 18:21:24 -07:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-23 11:35:02 +02:00
2026-07-03 07:38:16 +02:00
2026-06-19 10:14:34 -07:00
2026-06-08 18:21:29 -07:00
2026-06-08 18:21:27 -07:00
2026-07-03 07:37:43 +02:00
2026-06-11 15:17:30 -07:00
2026-06-15 03:59:45 +05:30
2026-06-12 16:43:10 -07:00
2026-06-25 10:18:40 -07:00
2026-07-01 15:26:29 +02:00
2026-06-09 12:42:20 +02:00
2026-06-08 10:21:54 -04:00
2026-06-08 12:06:41 -04:00
2026-06-23 18:36:41 -07:00
2026-06-08 18:21:23 -07:00
2026-06-26 22:18:34 -04:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-07-01 19:02:54 -07:00
2026-06-21 11:37:38 -07:00
2026-06-09 17:04:02 -05:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-06-11 13:41:25 +02:00
2026-06-16 08:44:43 +05:30
2026-06-17 09:18:14 +01:00
2026-06-09 10:13:04 -07:00
2026-07-03 07:38:16 +02:00
2026-06-10 11:08:23 +02:00
2026-07-03 07:38:14 +02:00
2026-07-03 07:38:16 +02:00
2026-06-10 00:58:04 +02:00
2026-06-15 03:05:50 +05:30
2026-06-07 12:36:13 -07:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-06-23 00:13:21 +02:00
2026-06-21 13:20:19 -07:00
2026-07-03 07:38:16 +02:00
2026-06-23 12:03:44 -07:00
2026-06-21 13:20:19 -07:00
2026-07-15 11:10:14 +02:00
2026-06-22 08:28:48 -07:00
2026-07-03 07:38:16 +02:00
2026-06-17 08:17:00 +01:00
2026-06-18 16:39:31 -07:00
2026-06-08 18:21:31 -07:00
2026-06-17 09:18:14 +01:00
2026-07-03 07:38:16 +02:00
2026-07-03 07:38:16 +02:00
2026-06-07 10:03:01 -07:00
2026-07-07 10:42:29 -04:00
2026-06-21 13:20:19 -07:00
2026-07-03 07:38:16 +02:00
2026-06-08 18:21:29 -07:00
2026-06-29 13:46:50 -06:00
2026-07-03 07:38:16 +02:00
2026-06-08 18:21:31 -07:00
2026-06-15 16:33:40 +02:00
2026-06-08 11:53:18 -07:00
2026-07-03 07:38:16 +02:00
2026-06-06 15:22:44 +02:00
2026-07-03 07:38:16 +02:00