From: Stanislav Fomichev <sdf.kernel@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, edumazet@kernel.org,
horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org,
rdunlap@infradead.org, michael.chan@broadcom.com,
pavan.chebbi@broadcom.com, sdf@fomichev.me,
almasrymina@google.com, bobbyeshleman@meta.com,
asml.silence@gmail.com, daniel@iogearbox.net,
razor@blackwall.org, leitao@debian.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: [PATCH net-next 2/7] net: devmem: charge the frag length to TX skb truesize
Date: Mon, 2 Nov 2026 11:14:33 -0800 [thread overview]
Message-ID: <20261102191438.1059771-3-sdf@fomichev.me> (raw)
In-Reply-To: <20261102191438.1059771-1-sdf@fomichev.me>
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@fomichev.me>
---
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
next prev parent reply other threads:[~2026-11-02 19:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 19:14 [PATCH net-next 0/7] net: devmem: size TX net_iovs from the dmabuf layout Stanislav Fomichev
2026-11-02 19:14 ` [PATCH net-next 1/7] bnxt_en: let the stack segment GSO skbs with too many frags Stanislav Fomichev
2026-11-02 19:14 ` Stanislav Fomichev [this message]
2026-11-02 20:22 ` [PATCH net-next 2/7] net: devmem: charge the frag length to TX skb truesize Mina Almasry
2026-11-02 23:23 ` Stanislav Fomichev
2026-11-02 19:14 ` [PATCH net-next 3/7] net: devmem: use niov_shift in net_devmem_get_niov_at() Stanislav Fomichev
2026-11-02 20:24 ` Mina Almasry
2026-11-02 19:14 ` [PATCH net-next 4/7] net: devmem: add a per-device netmem TX frag size limit Stanislav Fomichev
2026-11-02 20:31 ` Mina Almasry
2026-11-02 23:27 ` Stanislav Fomichev
2026-11-02 19:14 ` [PATCH net-next 5/7] bnxt_en: limit netmem TX frags to 32KB Stanislav Fomichev
2026-11-02 20:31 ` Mina Almasry
2026-11-02 19:14 ` [PATCH net-next 6/7] net: devmem: size TX net_iovs from the dmabuf sg table Stanislav Fomichev
2026-11-02 20:40 ` Mina Almasry
2026-11-02 23:37 ` Stanislav Fomichev
2026-11-03 2:33 ` Mina Almasry
2026-11-02 19:14 ` [PATCH net-next 7/7] selftests: drv-net: devmem: TX from a hugepage-backed dmabuf Stanislav Fomichev
2026-11-03 2:58 ` Mina Almasry
2026-11-02 20:07 ` [PATCH net-next 0/7] net: devmem: size TX net_iovs from the dmabuf layout Mina Almasry
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=20261102191438.1059771-3-sdf@fomichev.me \
--to=sdf.kernel@gmail.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=asml.silence@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=corbet@lwn.net \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=razor@blackwall.org \
--cc=rdunlap@infradead.org \
--cc=sdf@fomichev.me \
--cc=skhan@linuxfoundation.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
all inboxes | Powered by JetHome®