[Openvpn-devel,net-next,v4,5/9] udp: preserve write ownership across GSO segmentation
| Message ID | 84055d076e4df97aa0658920a14359d8543c7a84.1794234673.git.ralf@mandelbit.com |
|---|---|
| State | Changes Requested |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:6022:63cb:10b0:11a:a05e:cb97 with SMTP id
w11-n1csp802951lat;
Mon, 9 Nov 2026 07:09:34 -0800 (PST)
X-Forwarded-Encrypted: i=2;
AL+hErGPMiwziTXsEBvnyFLCd6p/hlIgdZ3fQD6AVg6OBeG/vO03+6meuyw6DKjikwZyeEYzJaPE7KBpjg0=@openvpn.net
X-Received: by 2002:a05:7301:430c:b0:36e:97b4:1071 with SMTP id
5a478bee46e88-37257aa2df0mr7427404eec.14.1794236974229;
Mon, 09 Nov 2026 07:09:34 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1794236974; cv=none;
d=google.com; s=arc-20260327;
b=DApIUqXe1mNO5NbL5+tMRpYxodK1QFWUmpQHdbxbbAe6Ph4qsYPuQK6G8LLngyliuO
7Cnw8uUJ0fd6fsVvsZhTAdBiiJ3Zf+jXg60YzRbSusTlUVMfCh1LiLS90ls3BMTtkzpF
6XfoWErGK2/2+I3NOltpsTX/TI9Tp3NhXLWDqb23AQPuJYWJyYwO4wGbZtiStAsbduFM
5ZmwyYL8/DSv/0q5u6aCzVZt8EtFp1M7IsiTkMu3bk+EvF/ATR/wbKd6Wzrs61U/c2tD
iDWEKgC+6KrMayB8uf3ttgkzEEJWnOCXTfcXXmcwCZWZvyu4N+3LSPQFQOELCl4ZXEkT
qcpg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20260327;
h=errors-to:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:dkim-signature:dkim-signature:dkim-signature:dkim-signature;
bh=WAw8KufN5s8i8XyOPzWMURaRGG/iIYhnnaA+5OeAi44=;
fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=;
b=LKfSgiv/hOxBg6jhlJfRKmwQQJRHkI6pO623WKQyiGKDxHzOaOe0Pnoy1v6q58g57O
JJdLeWJlDGi4G54VDMpFZmZFnTTun7/Hzerq9pI5XW1i+kLsoUw9gQiBFExxx0zA4eip
3kQgO6J4PNnIjxEP/r4UVIwum3cti4m2nufjvO/2YLnNeRad2Wcp3p+F4H0fkLkaaamG
CIAszBc3XwYH+Hzi39ohGKtwaxYbMrg8oWHxwlF2Eu3K7NDLkEu09A91kLIY1c/sewLA
N2R5RRjG6jol46ICz0m/3897uAH1j4+mRO6YSAzyuvXesWuzeL+ByFgKaLYpNWoDDKt7
BatQ==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=MxT9cP5f;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=bfAIRvhG;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=XMZurP34;
dkim=neutral (body hash did not verify) header.i=@mandelbit.com
header.s=MBO0001 header.b=gatLuNZa;
spf=pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net
Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7])
by mx.google.com with ESMTPS id
5a478bee46e88-37265cfce6fsi17401705eec.37.2026.11.09.07.09.33
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Mon, 09 Nov 2026 07:09:34 -0800 (PST)
Received-SPF: pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) client-ip=216.105.38.7;
Authentication-Results: mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=MxT9cP5f;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=bfAIRvhG;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=XMZurP34;
dkim=neutral (body hash did not verify) header.i=@mandelbit.com
header.s=MBO0001 header.b=gatLuNZa;
spf=pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:
List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:
Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender:
Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post:
List-Owner; bh=WAw8KufN5s8i8XyOPzWMURaRGG/iIYhnnaA+5OeAi44=; b=MxT9cP5fSXaGC7
HZTOn1e/HU3+dR1siGchable5RiIidHOnEa3wkjqJ4Sn7cds7HR1+/iqcZsmNGKcnniUlNTObr1Jr
5Kpi7PHBWR8E3a7wXppKYJCJgjA66c0BJ8Njh6yk4elXizlbSU4lQ/TKjn9djIrDsOEswoXBleN0t
cyU=;
Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com)
by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.100.1)
(envelope-from <openvpn-devel-bounces@lists.sourceforge.net>)
id 1xQR00-000000007mq-2GrD;
Mon, 09 Nov 2026 15:09:32 +0000
Received: from [172.30.29.66] (helo=mx.sourceforge.net)
by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1)
(envelope-from <ralf@mandelbit.com>) id 1xQQzx-000000007mM-3yTh
for openvpn-devel@lists.sourceforge.net;
Mon, 09 Nov 2026 15:09:29 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References:
In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:
Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive;
bh=rh0qPPlKu8oxeCnqlkYjkHoCwL/5rgHYqYqMPZGL0bM=; b=bfAIRvhGqCG+vHJ7mTDgkFer+N
EuNt+5dLgKYg+UhbTGVJDZ0GYERhRlyqUspO1NCmz27AyjdQFWBzAbqjLRC7Xd1GyzC5rcRkVRcRH
YsqH1xFBL0tGByg34YmLCfWOeDvvS9BW9yh8VRME0DItF8axeHtWt+R7Nn+FFCYBnqdM=;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x
;
h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:
Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post:
List-Subscribe:List-Post:List-Owner:List-Archive;
bh=rh0qPPlKu8oxeCnqlkYjkHoCwL/5rgHYqYqMPZGL0bM=; b=XMZurP343UsP67nhjtbyXdDRJm
rDnIj/mbWcdPFt43HIkhZrYrBz/RuN9u1GRLZ2blRFAuJ/rFLFh+n7TvTXmCCuRlAcO9NSaI0V2L8
itQKf94rdg7yxHJrrcO4VjT3/J2FZIsZOatsv3v38WmOefvAz9wLfQzsnv5t7x9H1Yfo=;
Received: from mout-b-112.mailbox.org ([195.10.208.42])
by sfi-mx-1.v28.lw.sourceforge.com with esmtps
(TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1)
id 1xQQzv-000000001VE-12R7 for openvpn-devel@lists.sourceforge.net;
Mon, 09 Nov 2026 15:09:29 +0000
Received: from smtp2.mailbox.org (smtp2.mailbox.org
[IPv6:2001:67c:2050:b231:465::2])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits)
server-digest
SHA256) (No client certificate requested)
by mout-b-112.mailbox.org (Postfix) with ESMTPS id 4jNY8v1D87z5wXZ
for <openvpn-devel@lists.sourceforge.net>;
Mon, 09 Nov 2026 16:09:19 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
s=MBO0001; t=1794236959;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=rh0qPPlKu8oxeCnqlkYjkHoCwL/5rgHYqYqMPZGL0bM=;
b=gatLuNZaAFg7IyZ8B2qvtk0axyKDCN/FauJAYTY40RZSAz9She3wdBMabpaI/jzd1oRSTl
dJtxtEBCP9eF/5dSymYua8A6RKL3OKA0HvnkTVM+19E+3chykatfdFDggq/2TY+Y7zVcAE
Co76NGkff0djDKPyMe6MXoLZF75YGAEXExg6dGBLbD/Zea6P6T+b9xUM3sdmmHlqoWAYv3
BvXEWCzU5t8ed5eyQovwiKRRA+pbg4yNB91JCd8GbXBN0BSqmCGIBKjGyK8FYwswSfAZi9
HSL7MSDzkkfi7zp70NBjg/JS4SgPIcJTSHllxUArMRPFfs+uHAsuc1fxOopjQA==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates
2001:67c:2050:b231:465::2 as permitted sender)
smtp.mailfrom=ralf@mandelbit.com
From: Ralf Lici <ralf@mandelbit.com>
To: openvpn-devel@lists.sourceforge.net
Date: Mon, 9 Nov 2026 16:09:03 +0100
Message-ID:
<84055d076e4df97aa0658920a14359d8543c7a84.1794234673.git.ralf@mandelbit.com>
X-Mailer: git-send-email 2.56.0
In-Reply-To: <cover.1794234673.git.ralf@mandelbit.com>
References: <cover.1794234673.git.ralf@mandelbit.com>
MIME-Version: 1.0
X-Rspamd-Queue-Id: 4jNY8v1D87z5wXZ
X-Spam-Score: -0.2 (/)
X-Spam-Report: Spam detection software,
running on the system "sfi-spamd-1.hosts.colo.sdot.me",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: UDP GSO segmentation currently propagates socket write
ownership
only when the aggregate uses sock_wfree. An encapsulator such as ovpn can
instead retain ownership from the payload socket, including t [...]
Content analysis details: (-0.2 points, 5.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Headers-End: 1xQQzv-000000001VE-12R7
Subject: [Openvpn-devel] [PATCH ovpn net-next v4 5/9] udp: preserve write
ownership across GSO segmentation
X-BeenThere: openvpn-devel@lists.sourceforge.net
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: <openvpn-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive:
<http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel>
List-Post: <mailto:openvpn-devel@lists.sourceforge.net>
List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: openvpn-devel-bounces@lists.sourceforge.net
X-getmail-retrieved-from-mailbox: Inbox
X-GMAIL-THRID: 1881393829400567318
X-GMAIL-MSGID: 1881393829400567318
|
| Series |
ovpn: preserve GSO batching
|
|
Commit Message
Ralf Lici
Nov. 9, 2026, 3:09 p.m. UTC
UDP GSO segmentation currently propagates socket write ownership only
when the aggregate uses sock_wfree. An encapsulator such as ovpn can
instead retain ownership from the payload socket, including tcp_wfree,
while repackaging its data as UDP GSO.
In that case the destructor remains on the aggregate and runs when
software segmentation consumes it, before the resulting UDP packets
complete transmission. This releases the write-memory charge early and
can wake TCP Small Queues prematurely.
Use is_skb_wmem to recognize the standard write-accounting destructors
and propagate the original destructor to every segment. These
destructors all release ownership using skb->sk and skb->truesize, so
the existing truesize adjustment remains applicable. Skbs owned through
sock_wfree are handled as before.
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
---
New in v4.
net/ipv4/udp_offload.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index cf07c3c6611a..d41529030fbb 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -481,6 +481,7 @@ static struct sk_buff *__udp_gso_segment_list(struct sk_buff *skb, struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, netdev_features_t features, bool is_ipv6) { + void (*destructor)(struct sk_buff *skb) = gso_skb->destructor; struct sock *sk = gso_skb->sk; unsigned int sum_truesize = 0; struct sk_buff *segs, *seg; @@ -542,7 +543,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, skb_pull(gso_skb, sizeof(*uh)); /* clear destructor to avoid skb_segment assigning it to tail */ - copy_dtor = gso_skb->destructor == sock_wfree; + copy_dtor = is_skb_wmem(gso_skb); if (copy_dtor) { gso_skb->destructor = NULL; gso_skb->sk = NULL; @@ -551,7 +552,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, segs = skb_segment(gso_skb, features); if (IS_ERR_OR_NULL(segs)) { if (copy_dtor) { - gso_skb->destructor = sock_wfree; + gso_skb->destructor = destructor; gso_skb->sk = sk; } return segs; @@ -571,7 +572,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, for (;;) { if (copy_dtor) { - seg->destructor = sock_wfree; + seg->destructor = destructor; seg->sk = sk; sum_truesize += seg->truesize; }