Re: [PATCH] mm/memcontrol: avoid stuck FLUSHING_CACHED_CHARGE bit on isolated cpus

From: Rik van Riel

Date: Fri Aug 28 2026 - 10:56:56 EST


On Fri, 2026-08-28 at 16:25 +0200, Michal Hocko wrote:
> On Fri 28-08-26 09:46:21, Rik van Riel wrote:
> > drain_all_stock() can leave FLUSHING_CACHED_CHARGE set after the
> > work is dropped.  It sets the bit before checking isolation and
> > schedule_drain_work() checks isolation and queues in a separate RCU
> > critical section, so housekeeping_update()'s synchronize_rcu() can
> > race the second check.
> >
> > drain_local_stock() only clears the bit for work that ran, so the
> > bit
> > remains set and the stock is never drained again.
> >
> > Reorganize the drain_all_stock() loop, reducing nesting, splitting
> > out local vs remote cpu handling, and skipping everything on
> > isolated
> > cpus, which solves the stuck FLUSHING_CACHED_CHARGE flag.
>
> Is there any reason why we cannot simply clear the flag if the work
> is
> not scheduled?
>
That should work, too.

I'm fine with whatever variant people prefer.

--
All Rights Reversed.