Re: [PATCH v1 04/26] mm: vmscan: refactor move_folios_to_lru()

From: Qi Zheng
Date: Mon Nov 10 2025 - 22:25:11 EST




On 11/11/25 11:17 AM, Shakeel Butt wrote:
On Tue, Nov 11, 2025 at 11:04:09AM +0800, Qi Zheng wrote:

On 11/11/25 12:47 AM, 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.

However, in the !CONFIG_HAVE_CMPXCHG_LOCAL case, mod_node_page_state()
still calls local_irq_save(). Is this feasible in the PREEMPT_RT kernel?


Yes we can disable irqs on PREEMPT_RT but it is usually frown upon and
it is usually requested to do so only for short window. However if

Got it.

someone running PREEMPT_RT on an arch without HAVE_CMPXCHG_LOCAL and has
issues with mod_node_page_state() then they can solve it then. I don't
think we need to fix that now.

OK.