Re: [v5 1/2] mm: disable interrupts while initializing deferred pages

From: Pavel Tatashin
Date: Tue Mar 13 2018 - 12:06:13 EST


Hi Andrew,

> > +/* Disable interrupts and save previous IRQ state in flags before locking */
> > +static inline
> > +void pgdat_resize_lock_irq(struct pglist_data *pgdat, unsigned long *flags)
> > +{
> > + unsigned long tmp_flags;
> > +
> > + local_irq_save(*flags);
> > + local_irq_disable();
> > + pgdat_resize_lock(pgdat, &tmp_flags);
> > +}
>
> As far as I can tell, this ugly-looking thing is identical to
> pgdat_resize_lock().

I will get rid of it, and use pgdat_resize_lock(). My confusion was that I
thought that local_irq_save() only saves the IRQ flags does not disable
them.

>
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1506,7 +1506,6 @@ static void __init deferred_free_pages(int nid, int zid, unsigned long pfn,
> > } else if (!(pfn & nr_pgmask)) {
> > deferred_free_range(pfn - nr_free, nr_free);
> > nr_free = 1;
> > - cond_resched();
> > } else {
> > nr_free++;
>
> And how can we simply remove these cond_resched()s? I assume this is
> being done because interrupts are now disabled? But those were there
> for a reason, weren't they?

We must remove cond_resched() because we can't sleep anymore. They were
added to fight NMI timeouts, so I will replace them with
touch_nmi_watchdog() in a follow-up fix.

Thank you for your review,
Pavel