Re: [RFC PATCH 0/5] softirq: Per vector threading v2

From: Frederic Weisbecker
Date: Wed Jan 17 2018 - 21:55:51 EST


On Wed, Jan 17, 2018 at 03:56:43PM -0800, Linus Torvalds wrote:
> On Wed, Jan 17, 2018 at 10:07 AM, Frederic Weisbecker
> <frederic@xxxxxxxxxx> wrote:
> >
> > I see, so you may want to test (possibly much) higher values of MAX_SOFTIRQ_RESTART,
> > such as 50 or 100.
>
> I suspect the "number of softiqs per jiffy" is hardly interesting at all.
>
> We used to allow up to 2mS or ten iterations per _invocation_, never
> mind per timer tick.
>
> I thought you were going to actally account for time, but I don't
> think you ended up doing that.

I did in the first version but then I thought you suggested that count per
jiffy. I probably misunderstood :)

>
> Maybe time isn't necessarily the thing to do, but just pure "count per
> jiffy" seems very bad.

Indeed, the more I think about it, the more doubts I have too. At least
I started to think that this metric alone is not enough.

>
> What I might suggest using instead:
>
> - do it by time. This may be too expensive, though. Keeping track of
> ns-level timing per invocation can be nasty.

Yeah I would like to avoid that if we can. I guess it's ok if it sums up
to rdtsc but I fear it's common to have a heavier version.

>
> - do it by "we got a new softirq event while handling another softirq
> event". That was our old count per invocation, except you could do it
> per softirq, and just allow *one* (ie keep a bitmask of "I've already
> handled this softirq", and if the restart results in it being
> triggered *again* you say "ok, I'll just move this to a workqueue"

That one is very tempting.

>
> - .. something else?
>
> I'd suggest trying the "if we get a new softirq event that we've
> already seen while we were already handling softirq events" thing.
> That should really take care of the networking case of "90% time spend
> in softirq handling during packet storms" thing. If we spend that much
> time on softirqs, we *will* get a new softirq while handling an old
> one occasionally.

Ok I'm going to try that for the v3.

Thanks.