Article View: linux.kernel.netdev
Article #20383Re: [PATCH net 2/4] net: skbuff: limit folio refcount when rearranging skb frags
From: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 09:19
Date: Sun, 22 Nov 2026 09:19
64 lines
10550 bytes
10550 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message explains why skb_split() keeps its
unconditional skb_frag_ref() by saying that "each split also allocates…
--
net: skbuff: limit folio refcount when rearranging skb frags
This patch replaces unconditional skb_frag_ref() calls with
skb_frag_try_ref() and skb_frags_try_ref() in skb_segment(),
skb_try_coalesce(), skb_shift() and tcp_clone_payload(). The goal is to
stop skbs from multiplying folio references until the folio refcount limit
is exceeded. skb_split() is deliberately left alone.
> skb_split() can still add one reference when splitting a frag. But each
> split also allocates a new skb that is charged to the socket, reaching
> the refcount limit that way would require a lot of socket memory, and the
> references go away once the data was acked, so it's not that relevant in
> practice. Making skb_split() fail is more involved, so let's leave it alone
> for now.
[Severity: Low]
Is this reasoning true for all skb_split() callers?
Socket charging and dropping the references on ACK both describe the TCP
callers, tcp_fragment() and tso_fragment() in net/ipv4/tcp_output.c.
skb_split() also has a non-TCP caller in batadv_frag_create() in
net/batman-adv/fragmentation.c:
net/batman-adv/fragmentation.c:batadv_frag_create() {
...
skb_fragment = dev_alloc_skb(ll_reserved + mtu + tailroom);
...
skb_split(skb, skb_fragment, skb->len - fragment_size);
...
}
The fragment skb there comes from dev_alloc_skb(), so it is not charged to
any socket. The data is not acked either.
The path is batadv_frag_send_packet()->batadv_frag_create()->skb_split()->
skb_split_no_header(). skb_split_no_header() still calls
skb_frag_ref(skb1, k) unconditionally whenever the split point falls inside
a frag.
The KUnit tests in net/core/net_test.c also call skb_split() on skbs that
have no socket.
The conclusion probably still holds for batman-adv. A packet is limited to
BATADV_FRAG_MAX_FRAGMENTS fragments, and the fragments are transmitted and
freed. Only the stated reason is TCP-specific.
Could the commit message say that the socket memory argument covers only
the TCP callers, and mention why the batman-adv path is also bounded?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-skb_refcount_overflow-v1-0-5551b4954c3f%40kernel.org
Technical Details
Message-ID:
<179533917726.3135.13005025144396516237@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368629-linux-kernel-netdev=dewy.ruReferences:
<20261118-skb_refcount_overflow-v1-2-5551b4954c3f@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368629-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/4] net: skbuff: limit folio refcount when rearranging skb frags Date: Sun, 22 Nov 2026 09:19:37 +0000 Organization: Usenet Network Message-ID: <179533917726.3135.13005025144396516237@kernel.org> References: <20261118-skb_refcount_overflow-v1-2-5551b4954c3f@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3605044"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:IyTp2zHY8frUsdvXQYmOMois7Ys= sha256:j5b3OfSB6jzBQEvmbTSX6Ax5AvkRKeIML5dz817DkHg= sha1:Eq91nqzZh3p8+KYL97lWttIPsws= sha256:JTLGD2witfUhlq6c1QxcVKXXe5to3Si+dr3hyfTX5a8= 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 AC156125D74; Sun, 22 Nov 2026 12:20:00 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 fkGMvZHGU2U3; Sun, 22 Nov 2026 12:19:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368629-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 34B7B125D71; Sun, 22 Nov 2026 12:19:47 +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 BABB134561; Sun, 22 Nov 2026 09:19:41 +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=1795339179; b=WiLhC8aigqskcD+j8LUsoSg/VaRu+IU6Ro/oeOvx1VFnVmeGOFyBKWg4bVhhtje16cGa DCK+zhR95kVTlqAQc+f4G7TGqNHuivkmoInMoEzg8ixFKadg+l4vPJAqcSbruNzXXC0ZG wrV7KfGVK/ljMloPJmRI8pnvuMwxQsdL+YfuR52Najf/lWfPzHLtvBHw5wGA8n1G6uyxn 3xaswrQounej73SwrraQeCBnKahGV6uhCsH8jR4sZOgj7Xih9w9xI9jo7h3akOnlkdJI7 OpwpOFPMNSoIWl9u5T9M/QFRFNAGqpD/XW2bJRwn3zZK+2ADw74OyJFbKTuPosSEIyw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795339179; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=BLi6FJ3YBdze32J1P5e4SyztLeVBldzrE4m0g/yjef8=; b=FiBthuYB7ZXoeRVxC4dro5S+bEhh/sKCjU5oT3kQ+pTAyEw7l51z8xon8yYkeEgZ2fNz +brMFJPxBT1G9k4K0MwN4NJfRfUNCNGwh/5iovivrzZsc9OG+DIuzPlQ5w3w/zSdV0vqe a3DnT4EBVCalevT1QY2qeDDE5MCYIWaMcmwBc3dn2TaUYFLHiKfypGG58N5CXhncHCL0P KEw7GFbWNrSoqj1AKm1vpjXg7xFF7dsctA/T0ZbuXfI5Lbr4AIwnzHK4EnrLlkL8NXTKV GNiLZX/09Km1t7Dx38rPRQpL3pPIK3GwsvMpeFtHTUAmNaBsJvL5X6cUKvkyF7m8D2A== 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=EMz0e8MK; 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 DA511606A690; Sun, 22 Nov 2026 09:19:39 +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=EMz0e8MK 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=1795339179; b=AZ5CmT1mupf4QKb6noDVm1xqL8bKG7zTlfedKcIWaJTLa36BxLjqg3SIff5JFYWcdIjz PJf34pk0EpqqH6wLc9bJgOCPPd6mvNBV/j+8wJ9MldAKOnm/+bc15ytrzJADJXj/3aDKW 4D8dBgoPNli2abLcNHlxrbdA2dIjqwu1p8RETOkDt2OLWcjX9GCo6eG8fjOVVHS/5bEYm 9ZxhEMV/eu99/CYx1fQQS9ayWBA6/fPqW6Ubmx1e/4VgccVShgZNfs3qnEn1vaQ4Slm+B Ia8680WXwUH7nC40yKMQ0vMNnZE4zn+fAdeD6ycF8A6t3zPoW7Iz8dKgtCZSM/ftdng== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795339179; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=BLi6FJ3YBdze32J1P5e4SyztLeVBldzrE4m0g/yjef8=; b=CbfSebqlyc25SUp2gHXs/6yITZSpU7hkpLGcg9qpsKCIC2TWYdu6VQNcvJKOWl3d17T8 M/2AFpJDvRPFL8kL9UlvelaYkM4jysLcCswE2A21eMMixf6VqPYjB0Qd/T/x/NAzPAkvu u9dUTXywS5o5v0tzKdWUDvd+AcGCJ2cBMpMSgRT7GvSU10kQ6nvnd4aXdI+U83apa6fGt aC29nI4GFck68quvkPmkorE4+QfdPM+InJifZV+so+dbg6RwyEZp0NOrBM7A+7CIhjvo7 CcsFDeutlo6CMUxj9WIiwroPgijsIaeWYiJoJ/jVMI1//RjKnezOmku4XK3RJ7I57sg== 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=EMz0e8MK; 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 07126606A33C; Sun, 22 Nov 2026 09:19:38 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A662A1F000C0; Sun, 22 Nov 2026 09:19:37 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795339178; bh=BLi6FJ3YBdze32J1P5e4SyztLeVBldzrE4m0g/yjef8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=EMz0e8MKeNv4rhcUPdw8SVX2ubd16Ms9Or8bDnmla+NICnuP9k8nsgLIN9WHn13RR UdUwl4QgvKX8JrP+YE1sXfgoox3UAEwF7ihCJEhWGuz3MjFhEZZzHihiEX9sNTeINi 4fthJLsn/DTFai9w+s/NaR4Zs654C4eLHS7vW/8kTaUL/Nem9t7/FwhPbcYGCCrCYy OZbBt1h5c4CfW76b+YAV+YTzxL2i+vJE+vrlhn0Lgci33sApB0Fa1UspuGJRPhtTod zlQiDq62XWHwaS4YZ8VJqaJ2kUsdu2qwpbJ9M679nAsTk1+S280TEHX5QqUNtS3rZ0 x9BS7BLfwH9WQ== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, akpm@linux-foundation.org, kas@kernel.org, songliubraving@fb.com, hannes@cmpxchg.org, riel@surriel.com, willy@infradead.org, ncardwell@google.com, kuniyu@google.com, pfalcato@suse.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org X-In-Reply-To: <20261118-skb_refcount_overflow-v1-2-5551b4954c3f@kernel.org> X-sashiko-severity: Low 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