From: sashiko-bot@kernel.org
To: "Björn Töpel" <bjorn@kernel.org>, bpf@vger.kernel.org
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net v3 4/4] xsk: Keep the shared info of zero-copy buffers in kernel memory
Date: Fri, 04 Dec 2026 09:57:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-249555@kernel.org> (raw)
In-Reply-To: <20261203095647.3448925-5-bjorn@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] xsk: order-1 kmalloc demotion on 4K multi-buffer XDP_PASS skb
heads
--
commit 398e24a8ed1c684ab049fa90f5ec27a7ab098093
Author: Björn Töpel <bjorn@kernel.org>
xsk: Keep the shared info of zero-copy buffers in kernel memory
This commit moves skb_shared_info for zero-copy XSK buffers out of UMEM
tailroom into struct xsk_buff_pool, marks those buffers with
XDP_FLAGS_SINFO_EXT, and stops reserving tailroom in
xsk_pool_get_rx_frame_size() and xdp_umem_reg().
> diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h
> index a40ad3f90f13c..ec74bf3ffa510 100644
> --- a/include/net/xdp_sock_drv.h
> +++ b/include/net/xdp_sock_drv.h
[ ... ]
> @@ -58,18 +53,7 @@ static inline u32 __xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
>
> static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
> {
> - u32 frame_size = __xsk_pool_get_rx_frame_size(pool);
> - struct xdp_umem *umem = pool->umem;
> - bool mbuf;
> -
> - /* Reserve tailroom only for zero-copy pools that opted into
> - * multi-buffer. The reserved area is used for skb_shared_info,
> - * matching the XDP core's xdp_data_hard_end() layout.
> - */
> - mbuf = pool->dev && (umem->flags & XDP_UMEM_SG_FLAG);
> - frame_size -= xsk_pool_get_tailroom(mbuf);
> -
> - return ALIGN_DOWN(frame_size, 128);
> + return ALIGN_DOWN(__xsk_pool_get_rx_frame_size(pool), 128);
> }
[Severity: Medium]
Does removing the tailroom subtraction here demote 4K-chunk multi-buffer
XDP_PASS skb head allocations to order-1 kmalloc-8k?
With 4096-byte UMEM chunks and zero headroom, xsk_pool_get_rx_frame_size()
grows from 3456 to 3840 bytes. On idpf (via libeth_xskfq_create()), a
multi-buffer jumbo packet returning XDP_PASS passes a 4096-byte head
(XDP_PACKET_HEADROOM + 3840) to xdp_zc_alloc_head():
net/core/xdp.c:xdp_zc_alloc_head() {
u32 truesize = SKB_HEAD_ALIGN(size);
...
if (truesize > PAGE_SIZE)
return __netdev_alloc_skb(dev, size, GFP_ATOMIC | __GFP_NOWARN);
}
Because SKB_HEAD_ALIGN(4096) is 4416 bytes (versus 4032 bytes before),
every such packet now bypasses system_page_pool and falls back to
__netdev_alloc_skb(), which exceeds SKB_WITH_OVERHEAD(PAGE_SIZE) and
allocates from kmalloc-8k instead of recycled order-0 pages.
This doubles the skb head memory footprint, loses page-pool recycling, and
risks GFP_ATOMIC order-1 allocation failures under memory fragmentation.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203095647.3448925-1-bjorn@kernel.org?part=4
next prev parent reply other threads:[~2026-12-04 9:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 9:56 [PATCH net v3 0/4] xsk: Keep the shared info of zero-copy buffers in kernel memory Björn Töpel
2026-12-03 9:56 ` [PATCH net v3 1/4] libeth: xsk: Count each XDP_TX buffer on its own Björn Töpel
2026-12-04 10:39 ` netdev-bot+sashiko
2026-12-04 14:08 ` Björn Töpel
2026-12-03 9:56 ` [PATCH net v3 2/4] xdp: Size zero-copy skbs from the data, not the frame size Björn Töpel
2026-12-03 14:04 ` Maciej Fijalkowski
2026-12-04 10:39 ` netdev-bot+sashiko
2026-12-04 14:09 ` Björn Töpel
2026-12-03 9:56 ` [PATCH net v3 3/4] intel: Copy the exact length of XSk packets to skbs Björn Töpel
2026-12-03 14:07 ` Maciej Fijalkowski
2026-12-04 14:51 ` Loktionov, Aleksandr
2026-12-03 9:56 ` [PATCH net v3 4/4] xsk: Keep the shared info of zero-copy buffers in kernel memory Björn Töpel
2026-12-03 15:16 ` Maciej Fijalkowski
2026-12-04 9:57 ` sashiko-bot [this message]
2026-12-04 10:39 ` netdev-bot+sashiko
2026-12-04 14:12 ` Björn Töpel
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=sashiko-outbox-249555@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=sashiko-reviews@lists.linux.dev \
/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