[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+X7er9A+gF-7Q=DB_EQfWxQO5X+kPuPqMi1xGbVAV2CA@mail.gmail.com>
Date: Wed, 3 Apr 2024 18:21:19 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Ayush Sawal <ayush.sawal@...lsio.com>, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Steffen Klassert <steffen.klassert@...unet.com>, Herbert Xu <herbert@...dor.apana.org.au>,
David Ahern <dsahern@...nel.org>, Boris Pismenny <borisp@...dia.com>,
John Fastabend <john.fastabend@...il.com>, Tariq Toukan <tariqt@...dia.com>,
Dragos Tatulea <dtatulea@...dia.com>, Simon Horman <horms@...nel.org>,
Sabrina Dubroca <sd@...asysnail.net>,
Ahelenia Ziemiańska <nabijaczleweli@...ijaczleweli.xyz>,
Pavan Chebbi <pavan.chebbi@...adcom.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>, Yunsheng Lin <linyunsheng@...wei.com>,
Florian Westphal <fw@...len.de>, David Howells <dhowells@...hat.com>,
Alexander Lobakin <aleksander.lobakin@...el.com>, Lorenzo Bianconi <lorenzo@...nel.org>,
Johannes Berg <johannes.berg@...el.com>
Subject: Re: [PATCH net-next v4 2/3] net: mirror skb frag ref/unref helpers
On Wed, Apr 3, 2024 at 5:28 PM Mina Almasry <almasrymina@...gle.com> wrote:
>
> Refactor some of the skb frag ref/unref helpers for improved clarity.
>
> Implement napi_pp_get_page() to be the mirror counterpart of
> napi_pp_put_page().
>
> Implement skb_page_ref() to be the mirror of skb_page_unref().
>
> Improve __skb_frag_ref() to become a mirror counterpart of
> __skb_frag_unref(). Previously unref could handle pp & non-pp pages,
> while the ref could only handle non-pp pages. Now both the ref & unref
> helpers can correctly handle both pp & non-pp pages.
>
> Now that __skb_frag_ref() can handle both pp & non-pp pages, remove
> skb_pp_frag_ref(), and use __skb_frag_ref() instead. This lets us
> remove pp specific handling from skb_try_coalesce.
>
> Additionally, since __skb_frag_ref() can now handle both pp & non-pp
> pages, a latent issue in skb_shift() should now be fixed. Previously
> this function would do a non-pp ref & pp unref on potential pp frags
> (fragfrom). After this patch, skb_shift() should correctly do a pp
> ref/unref on pp frags.
>
> Signed-off-by: Mina Almasry <almasrymina@...gle.com>
> Reviewed-by: Dragos Tatulea <dtatulea@...dia.com>
>
...
> #if IS_ENABLED(CONFIG_PAGE_POOL)
> +bool napi_pp_get_page(struct page *page)
> +{
> + page = compound_head(page);
> +
> + if (!is_pp_page(page))
> + return false;
> +
> + page_pool_ref_page(page);
> + return true;
> +}
> +EXPORT_SYMBOL(napi_pp_get_page);
It seems this could be inlined (along with is_pp_page())
Powered by blists - more mailing lists