Re: [PATCH v1 04/26] mm: vmscan: refactor move_folios_to_lru()
From: Harry Yoo
Date: Mon Nov 10 2025 - 19:43:16 EST
On Mon, Nov 10, 2025 at 08:47:57AM -0800, Shakeel Butt wrote:
> On Mon, Nov 10, 2025 at 02:43:21PM +0900, Harry Yoo wrote:
> > On Mon, Nov 10, 2025 at 12:30:06PM +0800, Qi Zheng wrote:
> > > > Maybe we could make it safe against re-entrant IRQ handlers by using
> > > > read-modify-write operations?
> > >
> > > Isn't it because of the RMW operation that we need to use IRQ to
> > > guarantee atomicity? Or have I misunderstood something?
> >
> > I meant using atomic operations instead of disabling IRQs, like, by
> > using this_cpu_add() or cmpxchg() instead.
>
> We already have mod_node_page_state() which is safe from IRQs and is
> optimized to not disable IRQs for archs with HAVE_CMPXCHG_LOCAL which
> includes x86 and arm64.
Nice observation, thanks!
> Let me send the patch to cleanup the memcg code which uses
> __mod_node_page_state.
I'll take a look.
--
Cheers,
Harry / Hyeonggon