Re: in_irq_or_nmi() and RFC patch
From: Jesper Dangaard Brouer
Date: Thu Mar 30 2017 - 05:47:12 EST
On Thu, 30 Mar 2017 09:35:02 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Thu, Mar 30, 2017 at 09:12:23AM +0200, Jesper Dangaard Brouer wrote:
> > 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.
>
> Ah, no. Its because when you do things like:
>
> local_irq_disable();
> local_bh_enable();
> local_irq_enable();
>
> you can loose a pending softirq.
>
> Bugger.. that irqs_disabled() is something we could do without.
Yes, I really don't like adding this irqs_disabled() check here.
> I'm thinking that when tglx finishes his soft irq disable patches for
> x86 (same thing ppc also does) we can go revert all these patches.
>
> Thomas, see:
>
> https://lkml.kernel.org/r/20170301144845.783f8cad@xxxxxxxxxx
The summary is Mel and I found a way to optimized the page allocator,
by avoiding a local_irq_{save,restore} operation, see commit
374ad05ab64d ("mm, page_alloc: only use per-cpu allocator for irq-safe
requests") [1] https://git.kernel.org/davem/net-next/c/374ad05ab64d696
But Tariq discovered that this caused a regression for 100Gbit/s NICs,
as the patch excluded softirq from using the per-cpu-page (PCP) lists.
As DMA RX page-refill happens in softirq context.
Now we are trying to re-enable allowing softirq to use the PCP.
My proposal is: https://lkml.kernel.org/r/20170329214441.08332799@xxxxxxxxxx
The alternative is to revert this optimization.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer