netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jesper Dangaard Brouer <hawk@kernel.org>
Cc: Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	netdev@vger.kernel.org, magnus.karlsson@intel.com,
	aleksander.lobakin@intel.com, ilias.apalodimas@linaro.org,
	toke@redhat.com, lorenzo@kernel.org,
	syzbot+ff145014d6b0ce64a173@syzkaller.appspotmail.com,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	Octavian Purdila <tavip@google.com>
Subject: Re: [PATCH v4 bpf 1/2] xdp: introduce xdp_convert_skb_to_buff()
Date: Tue, 28 Oct 2025 18:53:14 -0700	[thread overview]
Message-ID: <20251028185314.1ad62578@kernel.org> (raw)
In-Reply-To: <11142984-9bbe-4611-bbe7-fa5494036b8f@kernel.org>

On Tue, 28 Oct 2025 09:08:52 +0100 Jesper Dangaard Brouer wrote:
> > +	xdp->rxq->mem.type = page_pool_page_is_pp(virt_to_head_page(xdp->data)) ?
> > +				MEM_TYPE_PAGE_POOL : MEM_TYPE_PAGE_SHARED;  
> 
> We are slowly killing performance with these paper cuts.  The
> information we are looking for should be available via skb->pp_recycle,
> but instead we go lookup the page to deref that memory.  And plus the
> virt_to_head_page() is more expensive than virt_to_page().
> 
> Why don't we check skb->pp_recycle first, and then fall-back to checking
> the page to catch the mentioned problems?

I still think _all_ frags which may end up here are from the per CPU PP
since we CoW the skbs. So:

	DEBUG_NET_WARN_ON_ONCE(!skb->pp_recycle);
	xdp->rxq->mem.type = MEM_TYPE_PAGE_POOL;

? It is legal to have pp and non-pp frags in a single skb AFAIK.

  reply	other threads:[~2025-10-29  1:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 12:13 [PATCH v4 bpf 0/2] xdp: fix page_pool leaks Maciej Fijalkowski
2025-10-27 12:13 ` [PATCH v4 bpf 1/2] xdp: introduce xdp_convert_skb_to_buff() Maciej Fijalkowski
2025-10-27 14:31   ` Toke Høiland-Jørgensen
2025-10-28  8:08   ` Jesper Dangaard Brouer
2025-10-29  1:53     ` Jakub Kicinski [this message]
2025-10-29 11:26       ` Maciej Fijalkowski
2025-10-29 23:12         ` Jakub Kicinski
2025-10-27 12:13 ` [PATCH v4 bpf 2/2] veth: update mem type in xdp_buff Maciej Fijalkowski
2025-10-27 14:31   ` Toke Høiland-Jørgensen

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=20251028185314.1ad62578@kernel.org \
    --to=kuba@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hawk@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=ilias.apalodimas@linaro.org \
    --cc=lorenzo@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+ff145014d6b0ce64a173@syzkaller.appspotmail.com \
    --cc=tavip@google.com \
    --cc=toke@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).