Re: [PATCH] rcu: restore correct batch limiting

From: Paul E. McKenney
Date: Thu Oct 18 2012 - 12:35:34 EST


On Thu, Oct 18, 2012 at 06:10:28PM +0200, Eric Dumazet wrote:
> On Thu, 2012-10-18 at 08:25 -0700, Paul E. McKenney wrote:
> > On Thu, Oct 18, 2012 at 02:44:50PM +0200, Eric Dumazet wrote:
>
> > >
> > > Having 2 billions callbacks on one cpu would be problematic, I really
> > > hope nobody relies on this ;)
> >
> > Fair point! ;-)
> >
> > But just making everything long makes it quite easy to analyze.
> >
> > > I guess the 10/infinity switch should be smarter.
> > >
> > > something like the following maybe :
> > >
> > > rdp->blimit = max(blimit, rdp->qlen >> 6);
> > >
> > > (if queue is big, dont wait to hit 10000 before allowing more items to
> > > be handled per round)
> >
> > The -rt guys would not be amused. :-(
> >
> > But for non-realtime use, increasing rcutree.blimit either at boot or
> > via sysfs could make sense. It is also likely that I will move callback
> > processing to a kthread at some point, which would allow some additional
> > flexibility.
> >
>
> Ah, I now realize the loop can exceed blimit, but is it true for BH
> variant ? (Not really a problem for 3.6/3.7 kernels, but prior ones)

Yep, applies to all the RCU flavors.

> if (++count >= bl &&
> (need_resched() ||
> (!is_idle_task(current) && !rcu_is_callbacks_kthread())))
> break;
>
> I wonder if ksoftirqd should be included as well...

This would be safe only if ksoftirqd could be guaranteed to be the
lowest-priority process on the given CPU, which I do not believe to be
the case. The problem is that if ksoftirqd is not the lowest-priority
process on the given CPU, we can seriously delay that other process
for no good reason. The fact that ksoftirqd does local_bh_disable()
means that the scheduler cannot preempt it, either. :-(

> > Furthermore, it would be easy to have one default for non-rt and another
> > for -rt, if that would help.
> >
> > > Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
> > >
> > > Please dont forget stable teams. (3.2 + )
> >
> > Added both, please see below!
>
> Seems fine to me, thanks Paul !

Thank you for everything on this one!

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/