From: "Michael S. Tsirkin" <mst@redhat.com>
To: Simon Schippers <simon.schippers@tu-dortmund.de>
Cc: Brett A C Sheffield <bacs@librecast.net>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Jason Wang <jasowangio@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Tim Gebauer <tim.gebauer@tu-dortmund.de>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] tun/tap & vhost-net: make qdisc backpressure opt-in via IFF_BACKPRESSURE
Date: Wed, 8 Jul 2026 12:10:57 -0400 [thread overview]
Message-ID: <20260708120925-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <c743935b-7b6f-49f4-b1dd-3fe1cc528464@tu-dortmund.de>
On Wed, Jul 08, 2026 at 05:12:19PM +0200, Simon Schippers wrote:
> On 7/7/26 22:05, Brett A C Sheffield wrote:
> > On 2026-07-07 08:52, Simon Schippers wrote:
> >> Brett, can you try the two attached patches here with iperf3?
> >> I think testing with 8 and 16 threads is enough, so where there is a
> >> regression.
> >>
> >> The two patches are about time when to wake:
> >> Currently we wake after consuming half the internal ring buffer.
> >> One of the attached patches wakes after 2 cachelines (128 of 1000
> >> packets) and the other one just wakes once the ring buffer is empty.
> >>
> >> This would really help :)
> >
> > Sure...
> >
> >
>
> The reverted results for reference:
> 7.2.0-rc1 reverted:
>
> threads 1
> [ 5] 0.00-10.00 sec 15.3 GBytes 13.1 Gbits/sec 368 sender
> [ 5] 0.00-10.00 sec 2.00 GBytes 1.72 Gbits/sec receiver
>
> threads 2
> [SUM] 0.00-10.00 sec 15.9 GBytes 13.7 Gbits/sec 1567 sender
> [SUM] 0.00-10.00 sec 4.00 GBytes 3.43 Gbits/sec receiver
>
> threads 4
> [SUM] 0.00-10.00 sec 16.5 GBytes 14.1 Gbits/sec 6701 sender
> [SUM] 0.00-10.00 sec 8.00 GBytes 6.87 Gbits/sec receiver
>
> threads 8
> [SUM] 0.00-10.00 sec 16.2 GBytes 14.0 Gbits/sec 19319 sender
> [SUM] 0.00-10.00 sec 15.7 GBytes 13.5 Gbits/sec receiver
>
> threads 16
> [SUM] 0.00-10.00 sec 14.4 GBytes 12.4 Gbits/sec 43593 sender
> [SUM] 0.00-10.00 sec 14.4 GBytes 12.4 Gbits/sec receiver
>
>
> > 7.2.0-rc2 (unpatched)
> >
> > threads 1
> > [ 5] 0.00-10.00 sec 20.4 GBytes 17.5 Gbits/sec 0 sender
> > [ 5] 0.00-10.00 sec 2.00 GBytes 1.72 Gbits/sec receiver
> >
> > threads 2
> > [SUM] 0.00-10.00 sec 12.7 GBytes 10.9 Gbits/sec 0 sender
> > [SUM] 0.00-10.00 sec 4.00 GBytes 3.43 Gbits/sec receiver
> >
> > threads 8
> > [SUM] 0.00-10.00 sec 11.5 GBytes 9.85 Gbits/sec 0 sender
> > [SUM] 0.00-10.01 sec 11.4 GBytes 9.83 Gbits/sec receiver
> >
> > threads 16
> > [SUM] 0.00-10.00 sec 11.6 GBytes 9.95 Gbits/sec 0 sender
> > [SUM] 0.00-10.01 sec 11.5 GBytes 9.91 Gbits/sec receiver
> >
> >
> > 7.2.0-rc2 with 0001-tun-set-waking-threshold-to-ptr_ring_empty.patch
> >
> > threads 1
> > [ 5] 0.00-10.00 sec 19.6 GBytes 16.8 Gbits/sec 0 sender
> > [ 5] 0.00-10.00 sec 2.00 GBytes 1.72 Gbits/sec receiver
> >
> > threads 2
> > [SUM] 0.00-10.00 sec 11.1 GBytes 9.50 Gbits/sec 0 sender
> > [SUM] 0.00-10.00 sec 4.00 GBytes 3.43 Gbits/sec receiver
> >
> > threads 8
> > [SUM] 0.00-10.00 sec 10.8 GBytes 9.25 Gbits/sec 0 sender
> > [SUM] 0.00-10.01 sec 10.7 GBytes 9.23 Gbits/sec receiver
> >
> > threads 16
> > [SUM] 0.00-10.00 sec 10.9 GBytes 9.34 Gbits/sec 0 sender
> > [SUM] 0.00-10.01 sec 10.8 GBytes 9.30 Gbits/sec receiver
> >
> >
> > 7.2.0-rc2 with 0001-tun-set-waking-threshold-to-tx_ring.batch.patch
> >
> > threads 1
> > [ 5] 0.00-10.00 sec 19.6 GBytes 16.9 Gbits/sec 2 sender
> > [ 5] 0.00-10.00 sec 2.00 GBytes 1.72 Gbits/sec receiver
> >
> > threads 2
> > [SUM] 0.00-10.00 sec 13.9 GBytes 11.9 Gbits/sec 0 sender
> > [SUM] 0.00-10.00 sec 4.00 GBytes 3.43 Gbits/sec receiver
> >
> > threads 8
> > [SUM] 0.00-10.00 sec 12.7 GBytes 10.9 Gbits/sec 0 sender
> > [SUM] 0.00-10.01 sec 12.3 GBytes 10.6 Gbits/sec receiver
> >
> > threads 16
> > [SUM] 0.00-10.00 sec 12.5 GBytes 10.7 Gbits/sec 0 sender
> > [SUM] 0.00-10.00 sec 12.4 GBytes 10.7 Gbits/sec receiver
> >
> >
> >
> > HTH,
> >
> >
> > Brett
>
> Thank you again!
>
> These results show that waking earlier performs better in this case:
> For 8 threads we get 10.6 Gbit/s instead of 9.83 Gbit/s when waking early
> but we are still *far* from the 13.5 Gbit/s when we revert everything
> (see above I pasted the reverted results there).
>
> So I come to the conclusion:
>
> 1. Waking earlier/later will not fix the performance issues. It may
> improve the performance slightly.
> Apart from that we introduce smp_mb__after_atomic() for the re-check
> on producer side (noop on x86) and a full smp_mb() for the re-check on
> consumer side.
> Nothing else stands out to me apart from the overheads of
> netif_tx_stop_queue() and netif_tx_wake_queue(). But we must use
> those 2 functions one way or another.
>
> 2. Users may depend on the dropping. Without backpressure tun/tap acts
> like a pfifo qdisc which tail-drops. Some users may require this.
>
> --> I would merge this opt-in patchset, it should be fine (it is not
> flagged by Sashiko anymore btw). I would not be mad if it would not
> get merged but I am out of ideas on how to improve.
>
> Thanks,
> Simon
I am fine with it being opt in, but we IMHO, need to be more clear, for users,
opt in to what this is.
--
MST
prev parent reply other threads:[~2026-07-08 16:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 9:42 [PATCH net v2] tun/tap & vhost-net: make qdisc backpressure opt-in via IFF_BACKPRESSURE Simon Schippers
2026-07-06 10:11 ` Brett A C Sheffield
2026-07-06 13:23 ` Michael S. Tsirkin
2026-07-06 15:33 ` Simon Schippers
2026-07-06 17:10 ` Brett A C Sheffield
2026-07-07 6:52 ` Simon Schippers
2026-07-07 6:56 ` Simon Schippers
2026-07-07 20:05 ` Brett A C Sheffield
2026-07-08 15:12 ` Simon Schippers
2026-07-08 16:10 ` Michael S. Tsirkin [this message]
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=20260708120925-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=bacs@librecast.net \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jasowangio@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.schippers@tu-dortmund.de \
--cc=skhan@linuxfoundation.org \
--cc=tim.gebauer@tu-dortmund.de \
--cc=willemdebruijn.kernel@gmail.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