๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Stanislav Fomichev Wed, 11 Nov 2026 22:47
[PATCH net-next v4 2/5] net: devmem: charge the frag length to TX skb truesize
#14740
Author: Stanislav Fomichev
Date: Wed, 11 Nov 2026 22:47
39 lines
12594 bytes
Devmem TX charges each frag the net_iov size, PAGE_SIZE today:
zerocopy_fill_skb_from_devmem() adds PAGE_SIZE to skb->truesize per
frag and __zerocopy_sg_from_iter() charges it to sk_wmem_queued. TCP
uncharges in bytes as acked data is trimmed from the skb
(tcp_trim_head()) and uncharges the rest when the skb is freed. A frag
shorter than a page leaves the difference charged until then, which is
small with PAGE_SIZE net_iovs.

TX net_iovs are about to grow up to 2MB, while frags stay bounded by
the skb and many frags share a net_iov. Charging the net_iov size would
charge up to 2MB per frag: a 64KB skb with two frags would charge 4MB
and fill the default 4MB send buffer on its own.

Charge the frag length instead, which also matches what TCP uncharges.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Mina Almasry <almasrymina@google.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
---
 net/core/datagram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/datagram.c b/net/core/datagram.c
index ecc30a6f8302..489d92fe6dae 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -737,7 +737,7 @@ zerocopy_fill_skb_from_devmem(struct sk_buff *skb, struct iov_iter *from,
 
 		netmem_inc_ref(net_iov_to_netmem(niov));
 		skb_add_rx_frag_netmem(skb, i, net_iov_to_netmem(niov), off,
-				       size, PAGE_SIZE);
+				       size, size);
 		iov_iter_advance(from, size);
 		length -= size;
 		i++;
-- 
2.53.0-Meta
Re: [PATCH net-next v4 2/5] net: devmem: charge the frag length to TX skb truesize
#15458
Author: netdev-bot+sashiko
Date: Thu, 12 Nov 2026 22:48
40 lines
9586 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's author identity doesn't match its Signed-off-by
  identity.

--

net: devmem: charge the frag length to TX skb truesize

The devmem TX path in zerocopy_fill_skb_from_devmem() used to charge
PAGE_SIZE (the net_iov size) to skb->truesize for each frag. This patch
charges the frag length instead. With TX net_iovs about to grow to 2MB,
charging the net_iov size would overcharge the send buffer, and the frag
length also matches what TCP uncharges.

> Author: Stanislav Fomichev <sdf.kernel@gmail.com>
> [ ... ]
> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>

[Severity: Low]
This isn't a bug, but the author address and the Signed-off-by address
are different. The author is sdf.kernel@gmail.com, and the only sign-off
from the author is sdf@fomichev.me.

checkpatch.pl reports this as FROM_SIGN_OFF_MISMATCH ("From:/Signed-off-by:
email address mismatch"). The other patches in the series have the same
mismatch, from "bnxt_en: let the stack segment GSO skbs with too many
frags" through "selftests: drv-net: devmem: TX from a hugepage-backed
dmabuf".

When resending, could you add an in-body "From: Stanislav Fomichev
<sdf@fomichev.me>" line, or a Signed-off-by for the gmail address?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261111224740.2744522-1-sdf%40fomichev.me
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads