Re: in_irq_or_nmi() and RFC patch

From: Jesper Dangaard Brouer
Date: Thu Mar 30 2017 - 03:12:38 EST


On Thu, 30 Mar 2017 08:49:58 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Wed, Mar 29, 2017 at 09:44:41PM +0200, Jesper Dangaard Brouer wrote:
> > @@ -2481,7 +2481,11 @@ void free_hot_cold_page(struct page *page, bool cold)
> > unsigned long pfn = page_to_pfn(page);
> > int migratetype;
> >
> > - if (in_interrupt()) {
> > + /*
> > + * Exclude (hard) IRQ and NMI context from using the pcplists.
> > + * But allow softirq context, via disabling BH.
> > + */
> > + if (in_irq() || irqs_disabled()) {
>
> Why do you need irqs_disabled() ?

Because further down I call local_bh_enable(), which calls
__local_bh_enable_ip() which triggers a warning during early boot on:

WARN_ON_ONCE(in_irq() || irqs_disabled());

It looks like it is for supporting CONFIG_TRACE_IRQFLAGS.


> Also, your comment is stale, it still refers to NMI context.

True, as you told me NMI is implicit, as it cannot occur.

> > __free_pages_ok(page, 0);
> > return;
> > }

--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer