From: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
To: stable@vger.kernel.org
Cc: Alexander Drozdov <al.drozdov@gmail.com>
Subject: Q: Cherry-pick "af_packet: don't pass empty blocks for PACKET_V3" for 3.x stable kernels?
Date: Sat, 21 Oct 2017 01:02:40 +0200 [thread overview]
Message-ID: <1508539897@msgid.manchmal.in-ulm.de> (raw)
Hello,
it seems prudent to cherry-pick
commit 41a50d621a321b4c15273cc1b5ed41437f4acdfb
Author: Alexander Drozdov <al.drozdov@gmail.com>
Date: Tue Feb 24 08:18:28 2015 +0300
af_packet: don't pass empty blocks for PACKET_V3
Before da413eec729d ("packet: Fixed TPACKET V3 to signal poll when block is
closed rather than every packet") poll listening for an af_packet socket was
not signaled if there was no packets to process. After the patch poll is
signaled evety time when block retire timer expires. That happens because
af_packet closes the current block on timeout even if the block is empty.
Passing empty blocks to the user not only wastes CPU but also wastes ring
buffer space increasing probability of packets dropping on small timeouts.
to the stable kernels 3.2, 3.4 (still alive?), 3.16 and 3.18 - since
without that one the softflowd program may stall for a long time,
details below.
However according to the description it might be a idea to pick the
commit referred there as well. Honestly, I don't feel competent enough
to judge this and therefore ask for your expertise.
The problem seen in userland is as follows: The softflowd application
uses poll() in the main loop¹ to learn about updates from two sources:
The usual pcap handle, and a local socket to receive control messages
using the "softflowctl" program.
If the interface softflowd listens on has no traffic at all, the
pcap_dispatch() call does not return, making any access using
softflowctl stall. Also, "kill -9" is required to stop the softflowd
process.
This problem does not exist with newer kernels, reverse bisect led to
the above commit.
How to repeat:
# modprobe dummy numdummies=1
# ip link set up dev dummy0
# softflowd -d -i dummy0 -c /tmp/softflowd.ctl
In a second terminal:
# softflowctl -c /tmp/softflow.ctl statistics
After a few seconds of softflowd running, this command will stall -
until there's *any* traffic on dummy0 like "ping6 ff02::1%dummy0".
Related: It seems 3.2 and 3.4 have a performance issue in the above
softflowd scenario: There is a ksoftirqd process at around 50% CPU
usage. An additional reverse bisect led to 47aa8b6cbc and cherry-picking
that one indeed ends it. But that's for another day.
Christoph
¹ https://sources.debian.net/src/softflowd/0.9.9-3/softflowd.c/#L1897
reply other threads:[~2017-10-20 23:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1508539897@msgid.manchmal.in-ulm.de \
--to=linux-kernel.bfrz@manchmal.in-ulm.de \
--cc=al.drozdov@gmail.com \
--cc=stable@vger.kernel.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 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.