All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: frederic@kernel.org
Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
	alexander.levin@verizon.com, peterz@infradead.org,
	mchehab@s-opensource.com, hannes@stressinduktion.org,
	paulmck@linux.vnet.ibm.com, wanpeng.li@hotmail.com,
	dima@arista.com, tglx@linutronix.de, akpm@linux-foundation.org,
	pabeni@redhat.com, rrendec@arista.com, mingo@kernel.org,
	sgruszka@redhat.com, riel@redhat.com, edumazet@google.com
Subject: Re: [RFC PATCH 1/4] softirq: Limit vector to a single iteration on IRQ tail
Date: Sun, 21 Jan 2018 11:57:03 -0500 (EST)	[thread overview]
Message-ID: <20180121.115703.1454514585438593490.davem@davemloft.net> (raw)
In-Reply-To: <20180121163008.GB2879@lerouge>

From: Frederic Weisbecker <frederic@kernel.org>
Date: Sun, 21 Jan 2018 17:30:09 +0100

> On Fri, Jan 19, 2018 at 01:47:27PM -0500, David Miller wrote:
>> From: Linus Torvalds <torvalds@linux-foundation.org>
>> Date: Fri, 19 Jan 2018 10:25:03 -0800
>> 
>> > On Fri, Jan 19, 2018 at 8:16 AM, David Miller <davem@davemloft.net> wrote:
>> >>
>> >> So this "get requeued" condition I think will trigger always for
>> >> networking tunnel decapsulation.
>> > 
>> > Hmm. Interesting and a perhaps bit discouraging.
>> > 
>> > Will it always be just a _single_ level of indirection, or will double
>> > tunnels (I assume some people do that, just because the universe is
>> > out to get us) then result in this perhaps repeating several times?
>> 
>> Every level of tunnel encapsulation will trigger a new softirq.
>> 
>> So if you have an IP tunnel inside of an IP tunnel that will trigger
>> twice.
> 
> So we may likely need to come back to a call counter based limit :-s

I'm not so sure exactly to what extent we should try to handle that,
and if so exactly how.

The only reason we do this is to control stack usage.  The re-softirq
on tunnel decapsulation is functioning as a continuation of sorts.
If we are already running in the net_rx_action() softirq it would
be so much nicer and efficient to just make sure net_rx_action()
runs the rest of the packet processing.

Right now that doesn't happen because net_rx_action() runs only one
round of NAPI polling.  It doesn't re-snapshot the list and try
again before returning.

net_rx_action() has it's own logic like do_softirq() does for timing
out in the middle of it's work which may or may not have some further
influence upon fairness to other softirqs.

Basically, it runs a snapshot the NAPI poll list for this CPU until
either usecs_to_jiffies(netdev_budget_usecs) jiffies have elapsed or
the list snapshot has been fully processed.

The default netdev_budget_usecs is 2000, which is my math isn't broken
is 2 jiffies when HZ=1000.  I know why we use 2000 instead of 1000,
it's to handle the case where we are invoked very close to the end
of a jiffy.  That situation does happen often enough in practice to
cause performance problems.

It would seem that all of these issues are why the tendency is to deal
with measuring cost using time rather than a simpler heuristic such as
whether softirqs were retriggered during a softirq run.

  reply	other threads:[~2018-01-21 16:57 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 15:46 [RFC PATCH 0/4] softirq: Per vector threading v3 Frederic Weisbecker
2018-01-19 15:46 ` [RFC PATCH 1/4] softirq: Limit vector to a single iteration on IRQ tail Frederic Weisbecker
2018-01-19 16:16   ` David Miller
2018-01-19 18:25     ` Linus Torvalds
2018-01-19 18:47       ` David Miller
2018-01-21 16:30         ` Frederic Weisbecker
2018-01-21 16:57           ` David Miller [this message]
2018-01-19 15:46 ` [RFC PATCH 2/4] softirq: Per vector deferment to workqueue Frederic Weisbecker
2018-01-20  8:41   ` Pavan Kondeti
2018-01-21 16:11     ` Frederic Weisbecker
2018-01-21 17:50       ` Pavan Kondeti
2018-01-21 20:48         ` Frederic Weisbecker
2018-02-08 17:44   ` Sebastian Andrzej Siewior
2018-02-08 18:45     ` David Miller
2018-02-08 20:14       ` Dmitry Safonov
2018-02-08 20:22         ` David Miller
2018-02-08 20:30           ` Dmitry Safonov
2018-02-09  4:11             ` Mike Galbraith
2018-02-09 12:35               ` Sebastian Andrzej Siewior
2018-02-15 16:13     ` Frederic Weisbecker
2018-02-15 16:58       ` Sebastian Andrzej Siewior
2018-01-19 15:46 ` [RFC PATCH 3/4] softirq: Defer to workqueue when rescheduling is needed Frederic Weisbecker
2018-01-19 15:46 ` [RFC PATCH 4/4] softirq: Replace ksoftirqd with workqueues entirely Frederic Weisbecker
2018-01-22 19:58 ` [RFC PATCH 0/4] softirq: Per vector threading v3 Mauro Carvalho Chehab
2018-01-23 10:13 ` Paolo Abeni
2018-01-23 12:32   ` Dmitry Safonov
2018-01-24  2:12     ` Frederic Weisbecker
2018-01-23 16:22   ` David Miller
2018-01-23 16:57     ` Paolo Abeni
2018-01-23 17:42       ` Linus Torvalds
2018-01-23 18:01         ` Mike Galbraith
2018-01-23 18:24         ` David Miller
2018-01-24  1:57           ` Frederic Weisbecker
2018-01-24  2:01             ` Frederic Weisbecker
2018-01-24 14:54         ` Paolo Abeni
2018-01-24 15:05           ` David Miller
2018-01-24 16:11             ` Paolo Abeni
2018-02-07 14:18 ` Mauro Carvalho Chehab
2018-03-01 15:21   ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180121.115703.1454514585438593490.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=dima@arista.com \
    --cc=edumazet@google.com \
    --cc=frederic@kernel.org \
    --cc=hannes@stressinduktion.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@s-opensource.com \
    --cc=mingo@kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rrendec@arista.com \
    --cc=sgruszka@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=wanpeng.li@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.