Re: [PATCH 5/5] mm/mglru: reschedule between memcg reclaim attempts
From: Barry Song
Date: Sun Nov 01 2026 - 20:16:32 EST
On Tue, Oct 13, 2026 at 4:55 AM Max Kellermann <max.kellermann@xxxxxxxxx> wrote:
>
> shrink_one() can return immediately for empty or protected memcgs, and
> try_to_shrink_lruvec() can break out before reaching its
> cond_resched(). A scan through many memcgs can repeatedly rotate
> entries without giving other runnable tasks a scheduling opportunity.
>
> Call cond_resched_tasks_rcu_qs() (as the existing shrink_lruvec() loop
> does) after shrink_one(), while the memcg reference still pins the
> cursor and before reacquiring the RCU read lock. Also call it between
> bins and nulls-marker retries, covering scans that skip every entry.
I'd appreciate it if you could provide more details in the
changelog. Without this patch, are we seeing an RCU stall,
a soft lockup, or something else, right?
Also, as Andrew asked [1], does this patch alone fix the
problem?
I assume patches 3/5 are needed for the performance
improvement, but patch 5/5 is also needed as a quick fix
for the stalls.
[1] https://lore.kernel.org/linux-mm/20261101135047.61fc3f209b3235ed6fc96183@xxxxxxxxxxxxxxxxxxxx/
>
> Signed-off-by: Max Kellermann <max.kellermann@xxxxxxxxx>
Best,
Barry