From: "David Hildenbrand (Arm)" <david@kernel.org>
To: netdev-bot+sashiko@kernel.org
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
Subject: Re: [PATCH net 2/4] net: skbuff: limit folio refcount when rearranging skb frags
Date: Sun, 22 Nov 2026 13:48:15 +0100 [thread overview]
Message-ID: <7641a736-bf40-42c1-b169-9d21a8606638@kernel.org> (raw)
In-Reply-To: <179533917726.3135.13005025144396516237@kernel.org>
On 11/22/26 10:19, netdev-bot+sashiko@kernel.org wrote:
> 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?
I have no idea what AI is talking about and also I don't care. I have more
important things (on a Sunday!) than to do that think about such silly nitpicks.
What a waste of time.
--
Cheers,
David
next prev parent reply other threads:[~2026-11-22 12:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 8:32 [PATCH net 0/4] net: skbuff: limit pagecache folio refcount David Hildenbrand (Arm)
2026-11-18 8:32 ` [PATCH net 1/4] net: skbuff: limit folio refcount when copying skb frag references David Hildenbrand (Arm)
2026-11-19 13:53 ` David Hildenbrand (Arm)
2026-11-20 16:21 ` Stanislav Fomichev
2026-11-20 21:01 ` David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 12:58 ` David Hildenbrand (Arm)
2026-11-18 8:32 ` [PATCH net 2/4] net: skbuff: limit folio refcount when rearranging skb frags David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 12:48 ` David Hildenbrand (Arm) [this message]
2026-11-18 8:32 ` [PATCH net 3/4] net: skbuff: limit folio refcount when splicing pages into skbs David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 13:05 ` David Hildenbrand (Arm)
2026-11-18 8:32 ` [PATCH net 4/4] net: skbuff: limit folio refcount when splicing from sockets David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 13:09 ` David Hildenbrand (Arm)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7641a736-bf40-42c1-b169-9d21a8606638@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=horms@kernel.org \
--cc=kas@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ncardwell@google.com \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pfalcato@suse.de \
--cc=riel@surriel.com \
--cc=songliubraving@fb.com \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox