Re: [syzbot] [mm?] WARNING in __mod_zone_page_state

From: Sebastian Andrzej Siewior

Date: Mon Aug 31 2026 - 06:46:24 EST


On 2026-08-29 20:26:02 [-0700], Hugh Dickins wrote:
> > Something like below. I will run some tests before proposing a formal patch.
>
> Thanks for looking into this, Shakeel, but I don't think complicating
> __munlock_folio() is at all the right fix. This is peculiar to the use
> by mlock_drain_remote(), isn't it? Which is not taking the usual local_lock
> because the CPU is going offline. I would say, just take the local_lock in
> mlock_drain_remote(), but (I haven't read the history) for all I know,
> there may be PREEMPT_RT reasons why that would be completely wrong.

PREEMPT_RT does local_lock() as a replacement for various
preempt_disable()/ local_irq_save() usage in mm aiming for the same sort
of synchronisation.

On !RT __mod_zone_page_state() is usually invoked under an IRQ lock or
within an local_irq_save() section which ensures the per-CPU counter can
be updated safely without racing against another counter update due
preemption in the critical section.
The counter update does the not share the same local_lock() so for
PREEMPT_RT reasons the preempt_disable_nested() got added to ensure
preemption is disabled on RT, avoiding the race window since there can
not be any in-IRQ updates.

If this warning triggers on !PREEMPT_RT I would say you missed disabling
interrupts somewhere. Unless __mod_zone_page_state() relies on disabled
preemption, too if there are no longer any in-IRQ updates.

> Hugh

Sebastian