mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>
Cc: "Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
	"Larysa Zaremba" <larysa.zaremba@intel.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Song Liu" <song@kernel.org>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Menglong Dong" <imagedong@tencent.com>,
	"Mykola Lysenko" <mykolal@fb.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 4/4] xdp: remove unused {__,}xdp_release_frame()
Date: Tue, 14 Mar 2023 19:37:23 +0800	[thread overview]
Message-ID: <42712a3f-544f-6e45-1468-9f9fae7922e8@huawei.com> (raw)
In-Reply-To: <20230313215553.1045175-5-aleksander.lobakin@intel.com>

On 2023/3/14 5:55, Alexander Lobakin wrote:
> __xdp_build_skb_from_frame() was the last user of
> {__,}xdp_release_frame(), which detaches pages from the page_pool.
> All the consumers now recycle Page Pool skbs and page, except mlx5,
> stmmac and tsnep drivers, which use page_pool_release_page() directly
> (might change one day). It's safe to assume this functionality is not
> needed anymore and can be removed (in favor of recycling).
> 
> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> ---
>  include/net/xdp.h | 29 -----------------------------
>  net/core/xdp.c    | 15 ---------------
>  2 files changed, 44 deletions(-)
> 
> diff --git a/include/net/xdp.h b/include/net/xdp.h
> index d517bfac937b..5393b3ebe56e 100644
> --- a/include/net/xdp.h
> +++ b/include/net/xdp.h
> @@ -317,35 +317,6 @@ void xdp_flush_frame_bulk(struct xdp_frame_bulk *bq);
>  void xdp_return_frame_bulk(struct xdp_frame *xdpf,
>  			   struct xdp_frame_bulk *bq);
>  
> -/* When sending xdp_frame into the network stack, then there is no
> - * return point callback, which is needed to release e.g. DMA-mapping
> - * resources with page_pool.  Thus, have explicit function to release
> - * frame resources.
> - */
> -void __xdp_release_frame(void *data, struct xdp_mem_info *mem);
> -static inline void xdp_release_frame(struct xdp_frame *xdpf)
> -{
> -	struct xdp_mem_info *mem = &xdpf->mem;
> -	struct skb_shared_info *sinfo;
> -	int i;
> -
> -	/* Curr only page_pool needs this */
> -	if (mem->type != MEM_TYPE_PAGE_POOL)
> -		return;
> -
> -	if (likely(!xdp_frame_has_frags(xdpf)))
> -		goto out;
> -
> -	sinfo = xdp_get_shared_info_from_frame(xdpf);
> -	for (i = 0; i < sinfo->nr_frags; i++) {
> -		struct page *page = skb_frag_page(&sinfo->frags[i]);
> -
> -		__xdp_release_frame(page_address(page), mem);
> -	}
> -out:
> -	__xdp_release_frame(xdpf->data, mem);
> -}
> -
>  static __always_inline unsigned int xdp_get_frame_len(struct xdp_frame *xdpf)
>  {
>  	struct skb_shared_info *sinfo;
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index a2237cfca8e9..8d3ad315f18d 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -531,21 +531,6 @@ void xdp_return_buff(struct xdp_buff *xdp)
>  }
>  EXPORT_SYMBOL_GPL(xdp_return_buff);
>  
> -/* Only called for MEM_TYPE_PAGE_POOL see xdp.h */
> -void __xdp_release_frame(void *data, struct xdp_mem_info *mem)
> -{
> -	struct xdp_mem_allocator *xa;
> -	struct page *page;
> -
> -	rcu_read_lock();
> -	xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
> -	page = virt_to_head_page(data);
> -	if (xa)
> -		page_pool_release_page(xa->page_pool, page);

page_pool_release_page() is only call here when xa is not NULL
and mem->type == MEM_TYPE_PAGE_POOL.

But skb_mark_for_recycle() is call when mem->type == MEM_TYPE_PAGE_POOL
without checking xa, it does not seems symmetric to patch 3, if this is
intended?

> -	rcu_read_unlock();
> -}
> -EXPORT_SYMBOL_GPL(__xdp_release_frame);
> -
>  void xdp_attachment_setup(struct xdp_attachment_info *info,
>  			  struct netdev_bpf *bpf)
>  {
> 

  reply	other threads:[~2023-03-14 11:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 21:55 [PATCH bpf-next v3 0/4] xdp: recycle Page Pool backed skbs built from XDP frames Alexander Lobakin
2023-03-13 21:55 ` [PATCH bpf-next v3 1/4] selftests/bpf: robustify test_xdp_do_redirect with more payload magics Alexander Lobakin
2023-03-13 21:55 ` [PATCH bpf-next v3 2/4] net: page_pool, skbuff: make skb_mark_for_recycle() always available Alexander Lobakin
2023-03-13 21:55 ` [PATCH bpf-next v3 3/4] xdp: recycle Page Pool backed skbs built from XDP frames Alexander Lobakin
2023-03-15 14:55   ` Jesper Dangaard Brouer
2023-03-15 14:58     ` Alexander Lobakin
2023-03-16 17:10       ` Jesper Dangaard Brouer
2023-03-17 13:36         ` Alexander Lobakin
2023-03-13 21:55 ` [PATCH bpf-next v3 4/4] xdp: remove unused {__,}xdp_release_frame() Alexander Lobakin
2023-03-14 11:37   ` Yunsheng Lin [this message]
2023-03-14 12:27     ` Alexander Lobakin
2023-03-14 11:57 ` [PATCH bpf-next v3 0/4] xdp: recycle Page Pool backed skbs built from XDP frames Alexander Lobakin
2023-03-14 18:52   ` Alexei Starovoitov
2023-03-14 23:54     ` Alexei Starovoitov
2023-03-15  9:56       ` Alexander Lobakin
2023-03-15 10:54         ` Alexander Lobakin
2023-03-15 14:54           ` Ilya Leoshkevich
2023-03-15 18:00             ` Ilya Leoshkevich
2023-03-15 18:12               ` Alexander Lobakin
2023-03-15 18:26                 ` Ilya Leoshkevich
2023-03-16 13:22                   ` Alexander Lobakin
2023-03-15 16:55           ` Alexei Starovoitov
2023-03-14 22:30 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2023-03-13 21:42 Alexander Lobakin
2023-03-13 21:43 ` [PATCH bpf-next v3 4/4] xdp: remove unused {__,}xdp_release_frame() Alexander Lobakin
2023-03-13 19:08 [PATCH bpf-next v3 0/4] xdp: recycle Page Pool backed skbs built from XDP frames Alexander Lobakin
2023-03-13 19:08 ` [PATCH bpf-next v3 4/4] xdp: remove unused {__,}xdp_release_frame() Alexander Lobakin

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=42712a3f-544f-6e45-1468-9f9fae7922e8@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=imagedong@tencent.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=song@kernel.org \
    --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

all inboxes | Powered by JetHome®