Skip to content

Commit 9c94bbf

Browse files
alobakinAlexei Starovoitov
authored andcommitted
xdp: recycle Page Pool backed skbs built from XDP frames
__xdp_build_skb_from_frame() state(d): /* Until page_pool get SKB return path, release DMA here */ Page Pool got skb pages recycling in April 2021, but missed this function. xdp_release_frame() is relevant only for Page Pool backed frames and it detaches the page from the corresponding page_pool in order to make it freeable via page_frag_free(). It can instead just mark the output skb as eligible for recycling if the frame is backed by a pp. No change for other memory model types (the same condition check as before). cpumap redirect and veth on Page Pool drivers now become zero-alloc (or almost). Signed-off-by: Alexander Lobakin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 2c854e5 commit 9c94bbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/core/xdp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,8 @@ struct sk_buff *__xdp_build_skb_from_frame(struct xdp_frame *xdpf,
658658
* - RX ring dev queue index (skb_record_rx_queue)
659659
*/
660660

661-
/* Until page_pool get SKB return path, release DMA here */
662-
xdp_release_frame(xdpf);
661+
if (xdpf->mem.type == MEM_TYPE_PAGE_POOL)
662+
skb_mark_for_recycle(skb);
663663

664664
/* Allow SKB to reuse area used by xdp_frame */
665665
xdp_scrub_frame(xdpf);

0 commit comments

Comments
 (0)