Re: [syzbot] [mm?] WARNING in __mod_zone_page_state
From: Sebastian Andrzej Siewior
Date: Mon Aug 31 2026 - 06:33:08 EST
On 2026-08-30 10:29:46 [-0700], Hugh Dickins wrote:
> Oh for the good old days when we were allowed to say preempt_disable()!
I'm sorry for taking this away from you.
> > --- a/mm/mlock.c
> > +++ b/mm/mlock.c
> > @@ -141,11 +141,16 @@ static struct lruvec *__munlock_folio(struct folio *folio, struct lruvec *lruvec
> >
> > munlock:
> > if (folio_test_clear_mlocked(folio)) {
> > - __zone_stat_mod_folio(folio, NR_MLOCK, -nr_pages);
> > + /*
> > + * This runs both with and without the lruvec lock held, and
> > + * mlock_drain_remote() reaches it fully preemptible, so use
> > + * the accessors that serialize themselves.
>
> I'm very far from being a good advisor on PREEMPT_RT,
> but I think that comment about lruvec lock would be wrong there.
This change would eliminate the warning on !PREEMPT_RT and not cause any
further trouble for PREEMPT_RT.
Given that this it might mandate for
WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_VM) &&
!IS_ENABLED(CONFIG_PREEMPT_RT) &&
!!irqs_disabled());
in __mod_zone_page_state() and other places where
preempt_disable_nested() was added. The counters do rely on disabled
interrupts not preemption.
> Hugh
Sebastian