Article View: linux.kernel.netdev
Article #16372Re: [PATCH v1 net-next 1/8] tcp: Clean up the first loop in tcp_collapse().
From: Eric Dumazet
Date: Sat, 14 Nov 2026 15:32
Date: Sat, 14 Nov 2026 15:32
38 lines
9982 bytes
9982 bytes
Le sam. 14 nov. 2026 ร 05:01, Kuniyuki Iwashima <kuniyu@google.com> a รฉcrit : > > tcp_collapse() detects skb to start collapsing from in the > first loop. > > If the last skb has SYN or FIN, the condition is tested > again after the loop. > > skb_frags_readable() is placed inside and outside of the > loop as well. > > If we goto skip_this in both cases, we can remove the second > tests and simply replace end_of_skbs with the inverted loop > condition. > > Then, we do not need a test for tcp_collapse_one() too. > > Also, skb_frags_readable() should be tested after the fully > overlapping check. > > Let's clean up the loop. This is not only a cleanup. Before this patch, when a SYN/FIN skb was overlapping with the next skb, the loop was left with end_of_skbs == false, and the test following the loop made tcp_collapse() return: nothing after this skb was collapsed. After this patch, this skb is skipped and the following skbs are considered. I think the new behavior is fine, but please mention it in the changelog. Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Technical Details
Message-ID:
<CAL4Wiiq9VH0hw0=TnDc_f5v4AMpkFpuRB4t8vNME-KzKKzy1uQ@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363340-linux-kernel-netdev=dewy.ruReferences:
<20261114040101.1043546-1-kuniyu@google.com> <20261114040101.1043546-2-kuniyu@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363340-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v1 net-next 1/8] tcp: Clean up the first loop in tcp_collapse().
Date: Sat, 14 Nov 2026 16:32:43 +0100
Organization: Usenet Network
Message-ID: <CAL4Wiiq9VH0hw0=TnDc_f5v4AMpkFpuRB4t8vNME-KzKKzy1uQ@mail.gmail.com>
References: <20261114040101.1043546-1-kuniyu@google.com> <20261114040101.1043546-2-kuniyu@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="1600849"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BWu45Wsv46BziygBmzySuF5Lxpw= sha256:0nbQuhVVm2Cvgm0vqSgTZnkfOfl2zGjry8Uhacb2DMs=
sha1:LAVy3X5bZPmVkKuXfE0yxB9fQSY= sha256:VVQcV6S4k74VpqTUcBhREET3MlsKJlhre6DBBcLEWdY=
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 33088114852; Sat, 14 Nov 2026 18:33:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=kernel.org
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 9tqiMZwpb3Ky;
Sat, 14 Nov 2026 18:33:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363340-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id D554D114853; Sat, 14 Nov 2026 18:33:14 +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 209DF3408E; Sat, 14 Nov 2026 15:33:04 +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=1794670378;
b=IwJoOI/uUE5oU2p2PphZZ9nbKksHQdH/l3O+osfbihnK/Ppn+MzNCfejkMpYdNvhFcgY
twOgXinank6kcjzQJNdlE7hKC0Ms/R9QF6FaJU2tSmKuJTjwx3SL8vphWkfy4F2ene1FW
2zjDyjMQinRalrA442cJ5Mt8hvDTWvWSGRQDWgFQ8u4u4NhZq+2NkNBw9UBoC8r7t+jjp
yQwJ1467OcoDET4NvCX9mBCRnizxle9KbL2umVWUXGLzkmipulK76B/AZjgGbiXgWIFxl
HR7bYpghBMnWYrcNvoa40fSnwbjyEZ/y0HjrqsZ1VcdVeKSCRpdAT65jMg40/PvjsbA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794670378;
h=X-Original-To:Received:Received:DKIM-Signature:Received:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=tOdFgq6NJE5ZahFuNxVKUFHDjUOWhxrNt70ospd2l6U=;
b=5LQfSLg57h7uqA/tBU4UGMhKF8i3hqN3TV9FDFzJMYaE9JlPo2Hy5tB8kGTtLrtcJ1iZ
PJ2wNwbV8hdutY2EMBjh7rBsOHIJLIK8JwAYfBLOG/0QzEN0ZBU8PZVg4SoCupZUjPNOy
xtAqF0jOIjhFAxDdQKt8kz3lTqFekJ1LgBmOdi9gosjM4nRPFZLmablSM1KryCj7k/wk6
pgPAUZlO4my6goci3DpNXksFlJ+4g4j5EmeXAlKu9OaTTWdGb4bZESL3YBzSqSW85MZQ2
P3kkcQMcyzK7UO31syVLP8MtO5o4eEamMpPEpNEUuonn2kPcf6AP37T7uQ6K8F3VB2g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MODdELXk;
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 503D2606A323;
Sat, 14 Nov 2026 15:32:58 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MODdELXk
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794670377;
b=q1dZAebTq3uKON18ne+AVkLe/2eCjg/YFOKJE51qQCMyKM3OmgPbLWUDJt0K9UGePfVI
8xZ9T3jrA77cLGRQJoIcIy7xiM2vsMR9QSYuIRAQkoEYLeOJXgRm3bOOw8XfsuDaEN8vW
QSLX2E5591UqYmT7gwxXY5Tt/3pwU6Fve4RoG90HolV3Extc3OdgXsA2OAQrXye3aeelC
ZyqS7ZT49fWoBrz2Dw3dadWGBRalXonAVrEYrhwjo+zpEM3TN3zV3QYxAauZMOihGRNPG
uaQse9JYk/cxIw63392S48v1umM64SkyiGsAHQzD3whrKpjTrKDt8bLwwdf7UdnmzdQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794670377;
h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
bh=tOdFgq6NJE5ZahFuNxVKUFHDjUOWhxrNt70ospd2l6U=;
b=PvrgInYag2ZIyvCSvLUjPnLUTLGQaY4HPw1W15E4LeUD5f6k+omiy3a4E9Su0gY0RBrS
5LgERqeKEQcfUdhGry9X9Y3LA98MmBC/ziJFkXnDmz1tdPTP7H8KBSCLvnVNzTvtGA91I
1xwCiBuzScVZ0Xz/ZhYUtBRNE4vLZQ7DxWOoxcj/Sa8SJFWuBj7fHRCgLya3J5OwSHdGN
wuuiHqZevEf3/r2vfMTiQSxXB1apNGqGTf81IOKyW41CUbhZygnXjbrYeC0NK12zvAuhZ
RoR7AVrfmy3aHNUYBVdJPlWqqYcMRVwXSCUHG2Wd1cQ4n7oNJ5L/kTaZSHUhH4UJHGg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MODdELXk;
arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71A06606A332
for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 15:32:57 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 157A41F000C9
for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 15:32:57 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1794670377;
bh=tOdFgq6NJE5ZahFuNxVKUFHDjUOWhxrNt70ospd2l6U=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=MODdELXkolKksSulE5BngSIPe4RIgVMDNSyKYElgVBsPRVci7V8bOdc42hT2iOm3y
23UQTi80zop/5PfAuhJHNlFJGEeOTb7a1bD6tOGXPLlkdWbAYND/0rrhvekbQyMCy1
UX2pwNPFK1vnpwTvwgbC7Jr8hGBicbyYUmtY7iLxk1arsMdPdVV5qumDR5h1di5xrs
OB9phOX9VB0fYokQszTOdJe0B3fiKgiPbEIh73UFMtP0JQSFCFmSmiMw1FpH+LiQav
fCxklqqRd8/9K1RqdBIAzFMJCm/J6uAu4+wPd5XuZOwN/zkG6zk2DWOTRgbj7Vhg8+
G0fZ7+yAdisew==
X-Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-7f84a55cc06so1894070a34.2
for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 07:32:57 -0800 (PST)
X-Forwarded-Encrypted: i=1; AL+hErH199I5Wi1nDhbpnzfmITrb9GYZTLkdMXC4Jy+pLaEoc5/zVEQUB473ujZlxoc3JK4NQJOyMyM=@vger.kernel.org
X-Gm-Message-State: APuU4Z810KDUA6drqIfzZsL3d6+QGUzxW3qNdqt8fHS7syE+EUfQYyGp
2F8G/dD6P0e8t+2CHBb7mIYKB3EJpkAb/49Vg6IT9YuL2efkq+7gnzB6UqN/OuV0TEjO1eOAmVf
N9q1SqXNz41V6V9BPteaMkhP8uuyAM7Y=
X-Received: by 2002:a05:6820:2205:b0:713:e404:a96c with SMTP id
006d021491bc7-71ab4f76653mr3292281eaf.43.1794670376429; Sat, 14 Nov 2026
07:32:56 -0800 (PST)
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
X-In-Reply-To: <20261114040101.1043546-2-kuniyu@google.com>
X-Gmail-Original-Message-ID: <CAL4Wiiq9VH0hw0=TnDc_f5v4AMpkFpuRB4t8vNME-KzKKzy1uQ@mail.gmail.com>
X-Gm-Features: AclHuK_8xRSr4TiVruPvCxLe3Za149WO2vqfnb-l2Cr7CYIDmjFWSjCAt489d4Q
X-Cc: Neal Cardwell <ncardwell@google.com>, "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuni1840@gmail.com>, netdev@vger.kernel.org