Re: [PATCH v5 1/9] mm: list_lru: fix set_shrinker_bit() call during race with cgroup deletion
From: Usama Arif
Date: Thu May 28 2026 - 09:30:48 EST
On 27/05/2026 21:45, Johannes Weiner wrote:
> When list_lru_add() races with cgroup deletion, the shrinker bit is set
> on the wrong group and lost. This can cause a shrinker run to miss the
> cgroup that actually has the object.
>
> When the passed in memcg is dead, the function finds the first non-dead
> parent from the passed in memcg and adds the object there; but the
> shrinker bit is set on the memcg that was passed in.
>
> This bug is as old as the shrinker bitmap itself.
>
> Fix it by returning the "effective" memcg from the locking function, and
> have the caller use that.
>
> Fixes: fae91d6d8be5 ("mm/list_lru.c: set bit in memcg shrinker bitmap on first list_lru item appearance")
> Reported-by: Usama Arif <usama.arif@xxxxxxxxx>
> Reported-by: Sashiko
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> ---
> mm/list_lru.c | 26 +++++++++++++++-----------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
Acked-by: Usama Arif <usama.arif@xxxxxxxxx>