Re: [PATCH net-next v4 2/2] net: prevent mixing frags from different memory providers or bindings

From: Mina Almasry

Date: Tue Nov 10 2026 - 22:55:32 EST


On Mon, Nov 9, 2026 at 10:33 AM Stanislav Fomichev <sdf.kernel@xxxxxxxxx> wrote:
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -2692,8 +2692,9 @@ static int tcp_clone_payload(struct sock *sk, struct sk_buff *to,
> > probe_size - len);
> > len += todo;
> > skb_shinfo(to)->flags |= skb_shinfo(skb)->flags & SKBFL_SHARED_FRAG;
> > + to->unreadable |= skb->unreadable;
> > if (lastfrag &&
> > - skb_frag_page(fragfrom) == skb_frag_page(lastfrag) &&
> > + skb_frag_netmem(fragfrom) == skb_frag_netmem(lastfrag) &&
> > skb_frag_off(fragfrom) == skb_frag_off(lastfrag) +
> > skb_frag_size(lastfrag)) {
> > skb_frag_size_add(lastfrag, todo);
>
> From [0]:
>
> Maybe easier to not merge niovs here? Add '&& !skb_frag_is_net_iov' to
> that 'if (lastfrag' check? (or your new skb_has_net_iovs)
>
> Looks like it is tcp_mtu_probe path, not sure we care about merging there?

I'm guessing this is not an issue with pages because they're
PAGE_SIZE? But, seems maybe a bit lazy to just hammer all possible
net-iov coalescing? Is there a slightly cleaner and more generic check
( && skb_frag_size < PAGE_SIZE or something) so that we don't add
net-iov tech debt? Technically this will be an issue for hugepages in
the tx path or large folios or something.

Also I think it belongs in your patch series maybe. That's the one
adding the large niovs :P

--
Thanks,
Mina