[PATCH net-next 2/7] net: devmem: charge the frag length to TX skb truesize
From: Stanislav Fomichev
Date: Mon Nov 02 2026 - 17:22:50 EST
truesize isn't well defined for devmem TX frags: they point into a
dmabuf which stays mapped for the lifetime of the binding, and freeing
the skb releases no memory. The charge only feeds sk_sndbuf and TSQ,
which limit queued bytes.
Charge the frag length instead of PAGE_SIZE:
- TCP uncharges in bytes (tcp_trim_head(), tcp_fragment(),
tso_fragment()), so the charge must not be smaller than the frag.
PAGE_SIZE only guarantees that while net_iovs are PAGE_SIZE.
- Frags shorter than a page now count their length, not a page.
Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>
---
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