From: Rik van Riel <riel@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
Eric Dumazet <edumazet@google.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>,
Paolo Abeni <pabeni@redhat.com>, netdev <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jiri Pirko <jiri@mellanox.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@plumgrid.com>,
Alexander Duyck <aduyck@mirantis.com>,
Tom Herbert <tom@herbertland.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 0/2] net: threadable napi poll loop
Date: Tue, 10 May 2016 17:35:21 -0400 [thread overview]
Message-ID: <1462916121.16365.14.camel@redhat.com> (raw)
In-Reply-To: <1462915900.23934.99.camel@edumazet-glaptop3.roam.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 2439 bytes --]
On Tue, 2016-05-10 at 14:31 -0700, Eric Dumazet wrote:
> On Tue, 2016-05-10 at 14:09 -0700, Eric Dumazet wrote:
> >
> > On Tue, May 10, 2016 at 1:46 PM, Hannes Frederic Sowa
> > <hannes@stressinduktion.org> wrote:
> >
> > >
> > > I agree here, but I don't think this patch particularly is a lot
> > > of
> > > bloat and something very interesting people can play with and
> > > extend upon.
> > >
> > Sure, very rarely patch authors think their stuff is bloat.
> >
> > I prefer to fix kernel softirq.c, or at least show me that you
> > tried
> > hard enough.
> >
> > I am pretty sure that the following would work :
> >
> > When ksoftirqd is scheduled, remember this in a per cpu variable
> > (ksoftiqd_scheduled)
> >
> > When enabling BH , do not call do_softirq() if this variable is
> > set.
> >
> > ksoftirqd would clear the variable at the right place (probably in
> > run_ksoftirqd())
> >
> > Sure, this might add a lot of latency regressions, but lets fix
> > them.
> Only to give the idea (it is completely untested and probably buggy)
>
> diff --git a/kernel/softirq.c b/kernel/softirq.c
> index 17caf4b63342..cb30cfd76687 100644
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -56,6 +56,7 @@ EXPORT_SYMBOL(irq_stat);
> static struct softirq_action softirq_vec[NR_SOFTIRQS]
> __cacheline_aligned_in_smp;
>
> DEFINE_PER_CPU(struct task_struct *, ksoftirqd);
> +DEFINE_PER_CPU(bool, ksoftirqd_scheduled);
>
> const char * const softirq_to_name[NR_SOFTIRQS] = {
> "HI", "TIMER", "NET_TX", "NET_RX", "BLOCK", "BLOCK_IOPOLL",
> @@ -73,8 +74,10 @@ static void wakeup_softirqd(void)
> /* Interrupts are disabled: no need to stop preemption */
> struct task_struct *tsk = __this_cpu_read(ksoftirqd);
>
> - if (tsk && tsk->state != TASK_RUNNING)
> + if (tsk && tsk->state != TASK_RUNNING) {
> + __this_cpu_write(ksoftirqd_scheduled, true);
> wake_up_process(tsk);
> + }
> }
>
> /*
> @@ -162,7 +165,9 @@ void __local_bh_enable_ip(unsigned long ip,
> unsigned int cnt)
> */
> preempt_count_sub(cnt - 1);
>
> - if (unlikely(!in_interrupt() && local_softirq_pending())) {
> + if (unlikely(!in_interrupt() &&
> + local_softirq_pending() &&
> + !__this_cpu_read(ksoftirqd_scheduled))) {
> /*
>
You might need another one of these in invoke_softirq()
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-05-10 21:35 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 14:11 [RFC PATCH 0/2] net: threadable napi poll loop Paolo Abeni
2016-05-10 14:11 ` [RFC PATCH 1/2] net: implement threaded-able napi poll loop support Paolo Abeni
2016-05-10 14:11 ` [RFC PATCH 2/2] net: add sysfs attribute to control napi threaded mode Paolo Abeni
2016-05-10 14:29 ` [RFC PATCH 0/2] net: threadable napi poll loop Eric Dumazet
2016-05-10 15:51 ` David Miller
2016-05-10 16:03 ` Paolo Abeni
2016-05-10 16:08 ` Eric Dumazet
2016-05-10 20:22 ` Paolo Abeni
2016-05-10 20:45 ` David Miller
2016-05-10 20:50 ` Rik van Riel
2016-05-10 20:52 ` David Miller
2016-05-10 21:01 ` Rik van Riel
2016-05-10 20:46 ` Hannes Frederic Sowa
2016-05-10 21:09 ` Eric Dumazet
2016-05-10 21:31 ` Eric Dumazet
2016-05-10 21:35 ` Rik van Riel [this message]
2016-05-10 21:53 ` Eric Dumazet
2016-05-10 22:02 ` Eric Dumazet
2016-05-10 22:44 ` Eric Dumazet
2016-05-10 22:02 ` Rik van Riel
2016-05-11 17:55 ` Eric Dumazet
2016-05-10 22:32 ` Hannes Frederic Sowa
2016-05-10 22:51 ` Eric Dumazet
2016-05-11 6:55 ` Peter Zijlstra
2016-05-11 13:13 ` Hannes Frederic Sowa
2016-05-11 14:40 ` Eric Dumazet
2016-05-11 15:01 ` Rik van Riel
2016-05-11 15:50 ` Eric Dumazet
2016-05-11 21:56 ` Eric Dumazet
2016-05-12 20:07 ` Paolo Abeni
2016-05-12 20:49 ` Eric Dumazet
2016-05-12 20:58 ` Paolo Abeni
2016-05-12 21:05 ` Eric Dumazet
2016-05-13 16:50 ` Paolo Abeni
2016-05-13 17:03 ` Eric Dumazet
2016-05-13 17:19 ` Paolo Abeni
2016-05-13 17:36 ` Eric Dumazet
2016-05-16 13:10 ` Paolo Abeni
2016-05-16 13:38 ` Eric Dumazet
2016-05-11 9:48 ` Paolo Abeni
2016-05-11 13:08 ` Eric Dumazet
2016-05-11 13:39 ` Hannes Frederic Sowa
2016-05-11 13:47 ` Hannes Frederic Sowa
2016-05-11 14:38 ` Paolo Abeni
2016-05-11 14:45 ` Eric Dumazet
2016-05-11 22:47 ` Hannes Frederic Sowa
2016-05-10 15:57 ` Thomas Gleixner
2016-05-10 20:41 ` Paolo Abeni
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=1462916121.16365.14.camel@redhat.com \
--to=riel@redhat.com \
--cc=aduyck@mirantis.com \
--cc=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=hannes@stressinduktion.org \
--cc=jiri@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=tom@herbertland.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).