Re: [PATCH net v2] tun/tap & vhost-net: make qdisc backpressure opt-in via IFF_BACKPRESSURE
From: Simon Schippers
Date: Tue Jul 07 2026 - 03:06:29 EST
On 7/7/26 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 :)
Whoops send you the wrong patch (the opt-in patch again), here
is the wake on empty patch.
From a4343922e635cb1cab017b2e85cdd2e606cb667a Mon Sep 17 00:00:00 2001
From: Simon Schippers <simon.schippers@xxxxxxxxxxxxxx>
Date: Tue, 7 Jul 2026 08:38:31 +0200
Subject: [PATCH] tun: set waking threshold to ptr_ring_empty()
Only wake once the ptr_ring is empty, which results in later and less
calls of netif_tx_wake_queue().
---
drivers/net/tun.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index ffbe6f13fb1f..acbafd39f3ae 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2158,8 +2158,7 @@ static void __tun_wake_queue(struct tun_struct *tun,
smp_mb();
if (netif_tx_queue_stopped(txq)) {
tfile->cons_cnt += consumed;
- if (tfile->cons_cnt >= tfile->tx_ring.size / 2 ||
- __ptr_ring_empty(&tfile->tx_ring)) {
+ if (__ptr_ring_empty(&tfile->tx_ring)) {
netif_tx_wake_queue(txq);
tfile->cons_cnt = 0;
}
--
2.43.0