Article View: linux.kernel.netdev
Article #22621[PATCH net-next 0/3] veth: earlier txq wake and stop under backpressure
From: Simon Schippers
Date: Wed, 25 Nov 2026 15:23
Date: Wed, 25 Nov 2026 15:23
67 lines
11536 bytes
11536 bytes
While working on the veth BQL series [1], I noticed that veth was
sometimes faster with BQL enabled than without it. Debugging this showed
two reasons, both in how veth handles a full ptr_ring since commit
dc82a33297fc ("veth: apply qdisc backpressure on full ptr_ring to reduce
TX drops"):
- With BQL, the completions inside the NAPI loop wake the txq in the
middle of the poll. Without BQL, veth_poll() wakes the stopped peer
txq only at the end of the poll. The wake raises NET_TX_SOFTIRQ on the
consumer CPU, which then refills the ring from the qdisc itself
instead of consuming. Patch 2 wakes the txq in the middle of the poll,
so that the producer refills the ring on its own CPU. Patch 1 adds
PTR_RING_BATCH, which sets the wake point.
- With BQL, veth_xmit() stops the txq after a successful produce.
Without BQL, it stops the txq only after a produce has failed, so
every refill ends with NETDEV_TX_BUSY and a requeue, which adds up to
many requeues under a flood. Patch 3 stops the txq as soon as the
ring is full, with a __ptr_ring_check_produce() right after the
produce, as in my tun patch [2].
Here are some highlights for the whole series against net-next, with
fq_codel on a veth pair with GRO on and TSO off, so that all traffic
takes the NAPI ptr_ring path, as with an XDP program on the peer. In a
virtme-ng VM on isolated host CPUs at a fixed frequency, 95% confidence
intervals over 50 boots per kernel, 40 boots for two senders:
one sender, threaded NAPI net-next series
pktgen, 64 byte UDP 1078122 pps +24.8 +-0.5%
iperf3 TCP 32682 Mbit/s +1.4 +-0.6%
iperf3 UDP, 64 byte 362 Mbit/s +1.4 +-0.5%
two iperf3 senders, one queue
TCP, softirq NAPI 25798 Mbit/s +51.9 +-0.8%
TCP, threaded NAPI 22480 Mbit/s +15.0 +-1.2%
UDP, threaded NAPI 701 Mbit/s +15.2 +-0.5%
With a single sender and softirq NAPI the consumer runs on the sender's
CPU and the ring does not fill. iperf3 stays within 0.4% there, and
pktgen is 1.8% slower, which I could not separate from a shift of the
code layout, see patch 3. No other regressions were found.
With two senders and softirq NAPI, TCP through fq_codel was 36% slower
than with noqueue. With this series the gap is 2%.
The measurement setup, the test scripts, the isolation of the host CPUs
and the benchmark runs, were done with Claude Code (Claude Opus 5.5).
The scripts are in [3].
[1] https://lore.kernel.org/netdev/20260612083530.1650245-1-hawk@kernel.org/
[2] https://lore.kernel.org/netdev/20260803183641.96882-1-simon.schippers@tu-dortmund.de/
[3] https://github.com/simoschip2000/veth-txq-wake-bench
Simon Schippers (3):
ptr_ring: add PTR_RING_BATCH
veth: wake the peer txq in the middle of the NAPI poll
veth: stop the txq as soon as the ptr_ring is full
drivers/net/veth.c | 52 +++++++++++++++++++++++++++++++++-------
include/linux/ptr_ring.h | 7 +++++-
2 files changed, 50 insertions(+), 9 deletions(-)
base-commit: 612848d37e68b858e15815175f1c5e609e09d719
--
2.43.0
Technical Details
Message-ID:
<20261125152311.805325-1-simon.schippers@tu-dortmund.de>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371475-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371475-linux-kernel-netdev=dewy.ru From: simon.schippers@tu-dortmund.de (Simon Schippers) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next 0/3] veth: earlier txq wake and stop under backpressure Date: Wed, 25 Nov 2026 16:23:08 +0100 Organization: Usenet Network Message-ID: <20261125152311.805325-1-simon.schippers@tu-dortmund.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="241218"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:oIM3828dkbidy8Qw9ca95JODFVk= sha256:W+AEHnXkHPkZHShDqgsHHy0EOK5G0uwwcLGa//AQxeU= sha1:l6kFc8cx30XEfWs+Cv5OAiKlXog= sha256:uXcZus2Y6qyrQPuD4XVM7dyLyPvMOmXSMhIXye898oY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 28264125E7C; Wed, 25 Nov 2026 18:24:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=tu-dortmund.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qvD993UlRrVE; Wed, 25 Nov 2026 18:24:24 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371475-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=tu-dortmund.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 72820125E77; Wed, 25 Nov 2026 18:24:15 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 46805601E6; Wed, 25 Nov 2026 15:23:52 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795620228; b=1wSbfF1mb5XXREnZUXL7IYJV0vZdu7LcC5EpvH5enKqJ9MoikjjaO21k6OFhg22MWUtR MqxmcLzol7I+EDa/cUKyDJ6JW9W/3JCT4Ip8duWB0EZ2rZCB0s69czN2+mYGE6EErsQtK 4JgoFA1/G7CcHwMljIlKAPW/1Ah22Lz9cU8PoRaIyFmD8J5jErbN4/piB+cnn9verILfr r9hce38VnMM6XiDBUT36ZUiQ9TbZKLBy+KR9nVZpsUGQ7rMCY/R7WYriH1XeDj7O5SdYM sQ8fXLPr84lwzGxnABP1WFf8H3K5mM5wet4wreLxNSNne4uHu1ow6hSudUZTdNIAGEg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795620228; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Transfer-Encoding; bh=CA1LadP7NKMAaaB5YYb8cCVZscktvlEkvfaKa5ylWwg=; b=j2WmW9+T5kyS4uQiCQA/kYmwq1cNq5lj+4X0MzMS+6X5JvLs8+vUqVJfc1cmBlOjTMTR D8vOQ88tCe2JaJrIkqJ+rKV9az/t77T8Idky82Bl2rpbQATaH7IIbR9PBLKgyC4ph06nD /FNWciEF/XMJLQCKLbvw6WI0EmflHllxDDK1BtUaCK1PXcm6rUkqtIKjhFrzxeFzO2UqK W3/EmjzkwQdk+nLAocYwxWwjtFmUOYk8IMtGKPdP3aqsY5qT2s9S6bX24XIqpLFllilTC JFqTupSbdKJteepVsk1/G4rLjgg/xG8xatDweiTwJoV8ZgmEji46qTjoCEVps6oMllQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=tu-dortmund.de header.i=@tu-dortmund.de header.a=rsa-sha256 header.s=unimail header.b=O2t5jpJS; dmarc=pass header.from=tu-dortmund.de; spf=pass smtp.mailfrom=tu-dortmund.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC868606A338; Wed, 25 Nov 2026 15:23:48 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tu-dortmund.de header.i=@tu-dortmund.de header.a=rsa-sha256 header.s=unimail header.b=O2t5jpJS X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=129.217.128.51 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795620227; b=zT6exuN8NV12Sg2qLjCFKC0mY2ts34CYCPHdl/+sXnc1ya1JbP4Ph7Z/RxGcMIrun8RI TZdoq+SOR6mLNhVOmpT/Xrj9a/UuR2/0od3EbbZW0jr62kW4KtR4xh63LwJz5W764/57U 9NFMt1EEUdIS599U7W0XL7ak7pqX0VpE/FFytXYl1i1T/iKKszD5swVfuBWZn18Oo5Qtf 1kbURPYMiOgZn/wGxBUjzC2w5NZSvi08Q5yZnYmFKcLt0QxQV4uEf2LEG8GHOHw8QPCQt rHByRqWNzTvzCgaaq1JcKPPMk2OIIt2je9znq8eNXQJrlKmo+aA0M8XJTY6bJ+3uGLQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795620227; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=CA1LadP7NKMAaaB5YYb8cCVZscktvlEkvfaKa5ylWwg=; b=jX1kgcHgsK4xcVhadRMlH+3eRJOuWymNypHYEEgpLhkZAM1gnrdyqGeqves3bCcx7I3d s3dGxn+VN0+btEiY28pTwPZNCESun2HDc+xjs51oiojmx31c7nr4yO6hqHpZolEviiUC7 9IkXDKH6nriUUpm48THKBrolorKjshS1ODSa80YidMBPu9PKUvgka6q00YzNjW2C9Of9C 1HqD/9MwzmnS8CsBQVuQJC7cnETPZeKCSDTmDYWO3QvcFOng+tvZ7e2NPKaUlsL86LsMq sBZzjZda4IfvJDizaLgz6kGrcUqqeoQVB5E2g7fy21Z3L+WUfaYa22Q4nK93WP/TRFA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=tu-dortmund.de; spf=pass smtp.mailfrom=tu-dortmund.de; dkim=pass header.d=tu-dortmund.de header.i=@tu-dortmund.de header.a=rsa-sha256 header.s=unimail header.b=O2t5jpJS; arc=none smtp.remote-ip=129.217.128.51 X-Received: from unimail.uni-dortmund.de (mx1.hrz.uni-dortmund.de [129.217.128.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CA6A606A326; Wed, 25 Nov 2026 15:23:45 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8CA6A606A326 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=tu-dortmund.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tu-dortmund.de X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tu-dortmund.de; s=unimail; t=1795620197; bh=CA1LadP7NKMAaaB5YYb8cCVZscktvlEkvfaKa5ylWwg=; h=From:To:Cc:Subject:Date; b=O2t5jpJSHFSf2aPvggx1b43/Nf/2Fgw46VfpEoUKsgtAouupnOW+I5Z3JQmun/lKB cFTqZpl4h5a2OuNk0URSDnDpJqzDVfKjhaelScPaJVKD8zbD8WO9AzUn6KECaJ+6F9 iYKdIDThhLIwfGk6QemAB2/cqa//s0m9Vm7cFpvY= X-Received: from simon-Latitude-5450.cni.e-technik.tu-dortmund.de ([129.217.186.207]) (authenticated bits=0) by unimail.uni-dortmund.de (8.19.0.2/8.19.0.2) with ESMTPSA id 6APFNERK004665 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 25 Nov 2026 16:23:15 +0100 (CET) X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Jesper Dangaard Brouer <hawk@kernel.org>, Tim Gebauer <tim.gebauer@tu-dortmund.de>, Jonas Köppeler <j.koeppeler@tu-berlin.de>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowangio@gmail.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Schippers <simon.schippers@tu-dortmund.de> X-Mailer: git-send-email 2.43.0 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list