From: Jesper Dangaard Brouer <jbrouer@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Eric Dumazet <edumazet@google.com>,
Josef Griebichler <griebichler.josef@gmx.at>,
Peter Zijlstra <peterz@infradead.org>,
Mauro Carvalho Chehab <mchehab@s-opensource.com>,
Alan Stern <stern@rowland.harvard.edu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
USB list <linux-usb@vger.kernel.org>,
Rik van Riel <riel@redhat.com>, Paolo Abeni <pabeni@redhat.com>,
Hannes Frederic Sowa <hannes@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>, Jonathan Corbet <corbet@lwn.net>,
LMML <linux-media@vger.kernel.org>,
David Miller <davem@davemloft.net>,
Marek Majkowski <marek@cloudflare.com>
Subject: Re: dvb usb issues since kernel 4.9
Date: Wed, 10 Jan 2018 10:45:14 +0100 [thread overview]
Message-ID: <20180110104514.4cd0e94a@redhat.com> (raw)
In-Reply-To: <CA+55aFwq42Nzq47csw=ME8zbHYiw2rPN_Zp+=+Bu+Ruq9XquhQ@mail.gmail.com>
On Tue, 9 Jan 2018 10:58:30 -0800 Linus Torvalds <torvalds@linux-foundation.org> wrote:
> So I really think "you can use up 90% of CPU time with a UDP packet
> flood from the same network" is very very very different - and
> honestly not at all as important - as "you want to be able to use a
> USB DVB receiver and watch/record TV".
>
> Because that whole "UDP packet flood from the same network" really is
> something you _fundamentally_ have other mitigations for.
>
> I bet that whole commit was introduced because of a benchmark test,
> rather than real life. No?
I believe this have happened in real-life. In the form of DNS servers
not being able to recover after long outage, where DNS-TTL had timeout
causing legitimate traffic to overload their DNS servers. The goodput
answers/sec from their DNS servers were too low, when bringing them
online again. (Based on talk over beer at NetDevConf from a guy
claiming they ran DNS for AWS).
The commit 4cd13c21b207 ("softirq: Let ksoftirqd do its job") tries to
address a fundamental problem that the network stack have when
interacting with softirq in overload situations.
(Maybe we can come up with a better solution?)
Before this commit, when application run on same CPU as softirq, the
kernel have a bad "drop off cliff" behavior, when reaching above the
saturation point.
This is confirmed in CloudFlare blogpost[1], which used a kernel that
predates this commit. From[1] section: "A note on NUMA performance"
Quote:"
1. Run receiver on another CPU, but on the same NUMA node as the RX
queue. The performance as we saw above is around 360kpps.
2. With receiver on exactly same CPU as the RX queue we can get up to
~430kpps. But it creates high variability. The performance drops down
to zero if the NIC is overwhelmed with packets."
The behavior problem here is "performance drops down to zero if the NIC
is overwhelmed with packets". That is a bad way to handle overload.
Not only when attacked, but also when bringing a service online after
an outage.
What essentially happens is that:
1. softirq NAPI enqueue 64 packets into socket.
2. application dequeue 1 packet and invoke local_bh_enable()
3. causing softirq to run in app-timeslice, again enq 64 packets
4. app only see goodput of 1/128 of packets
That is essentially what Eric solved with his commit, avoiding (3)
local_bh_enable() to invoke softirq if ksoftirqd is already running.
Maybe we can come up with a better solution?
(as I do agree this was a too big-hammer affecting other use-cases)
[1] https://blog.cloudflare.com/how-to-receive-a-million-packets/
p.s. Regarding quote[1] point "1.", after Paolo Abeni optimized the UDP
code, that statement is no longer true. It now (significantly) faster to
run/pin your UDP application to another CPU than the RX-CPU.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2018-01-10 9:45 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <trinity-35b3a044-b548-4a31-9646-ed9bc83e6846-1513505978471@3c-app-gmx-bs03>
[not found] ` <20171217120634.pmmuhdqyqmbkxrvl@gofer.mess.org>
[not found] ` <20171217112738.4f3a4f9b@recife.lan>
[not found] ` <trinity-1fa14556-8596-44b1-95cb-b8919d94d2d4-1515251056328@3c-app-gmx-bs15>
2018-01-06 19:54 ` dvb usb issues since kernel 4.9 Mauro Carvalho Chehab
2018-01-06 21:07 ` Aw: " Josef Griebichler
2018-01-06 21:44 ` Alan Stern
2018-01-07 11:03 ` Mauro Carvalho Chehab
2018-01-07 15:41 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1801071010540.13425-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2018-01-07 17:01 ` Aw: " Josef Griebichler
2018-01-08 9:43 ` Mauro Carvalho Chehab
2018-01-08 16:10 ` Alan Stern
2018-01-08 16:26 ` Aw: " Josef Griebichler
2018-01-08 16:31 ` Alan Stern
2018-01-08 17:15 ` Aw: " Josef Griebichler
2018-01-08 17:35 ` Alan Stern
2018-01-08 20:40 ` Jesper Dangaard Brouer
2018-01-08 21:31 ` Jesper Dangaard Brouer
2018-01-08 21:44 ` Peter Zijlstra
2018-01-08 22:16 ` Jesper Dangaard Brouer
2018-01-09 16:51 ` Aw: " Josef Griebichler
2018-01-09 17:27 ` Eric Dumazet
2018-01-09 17:48 ` Linus Torvalds
2018-01-09 17:57 ` Eric Dumazet
2018-01-09 18:58 ` Linus Torvalds
2018-01-09 21:48 ` Eric Dumazet
2018-01-10 9:45 ` Jesper Dangaard Brouer [this message]
2018-01-12 21:13 ` Mauro Carvalho Chehab
2018-01-12 21:48 ` Eric Dumazet
2018-01-13 9:09 ` Mauro Carvalho Chehab
2018-01-13 10:46 ` Mauro Carvalho Chehab
2018-01-07 21:23 ` Linus Torvalds
2018-01-08 10:02 ` Mauro Carvalho Chehab
2018-01-08 11:59 ` Jesper Dangaard Brouer
2018-01-08 12:53 ` Mauro Carvalho Chehab
2018-01-08 16:25 ` Alan Stern
2018-01-08 17:55 ` Ingo Molnar
2018-01-08 18:32 ` Linus Torvalds
2018-01-08 19:15 ` Alan Stern
2018-01-08 19:51 ` Linus Torvalds
2018-01-09 17:42 ` Mauro Carvalho Chehab
2018-01-09 17:55 ` Linus Torvalds
2018-01-09 21:26 ` Jesper Dangaard Brouer
2018-01-10 3:02 ` Mike Galbraith
2018-07-17 11:54 ` Hanna Hawa
2018-07-17 17:09 ` Linus Torvalds
2018-07-17 18:07 ` Hanna Hawa
2018-07-17 22:21 ` Mauro Carvalho Chehab
2018-01-26 14:17 ` Mauro Carvalho Chehab
2018-01-26 19:37 ` Mauro Carvalho Chehab
2018-01-29 13:51 ` Mauro Carvalho Chehab
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=20180110104514.4cd0e94a@redhat.com \
--to=jbrouer@redhat.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=griebichler.josef@gmx.at \
--cc=hannes@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=marek@cloudflare.com \
--cc=mchehab@s-opensource.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=stern@rowland.harvard.edu \
--cc=torvalds@linux-foundation.org \
/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).