* [PATCH net-next v2] net: page_pool: rename page_pool_is_last_ref()
@ 2024-12-15 21:29 Jakub Kicinski
2024-12-16 8:52 ` Jesper Dangaard Brouer
2024-12-18 2:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2024-12-15 21:29 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, Jakub Kicinski, Alexander Lobakin,
Ilias Apalodimas, hawk, asml.silence, almasrymina
page_pool_is_last_ref() releases a reference while the name,
to me at least, suggests it just checks if the refcount is 1.
The semantics of the function are the same as those of
atomic_dec_and_test() and refcount_dec_and_test(), so just
use the _and_test() suffix.
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Hopefully this doesn't conflict with anyone's work, I've been
deferring sending this rename forever because I always look
at it while reviewing an in-flight series and then I'm worried
it will conflict.
v2:
- rebased on Olek's changes
v1: https://lore.kernel.org/20241213153759.3086474-1-kuba@kernel.org
CC: hawk@kernel.org
CC: ilias.apalodimas@linaro.org
CC: aleksander.lobakin@intel.com
CC: asml.silence@gmail.com
CC: almasrymina@google.com
---
include/net/page_pool/helpers.h | 4 ++--
net/core/page_pool.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h
index e555921e5233..776a3008ac28 100644
--- a/include/net/page_pool/helpers.h
+++ b/include/net/page_pool/helpers.h
@@ -306,7 +306,7 @@ static inline void page_pool_ref_page(struct page *page)
page_pool_ref_netmem(page_to_netmem(page));
}
-static inline bool page_pool_is_last_ref(netmem_ref netmem)
+static inline bool page_pool_unref_and_test(netmem_ref netmem)
{
/* If page_pool_unref_page() returns 0, we were the last user */
return page_pool_unref_netmem(netmem, 1) == 0;
@@ -321,7 +321,7 @@ static inline void page_pool_put_netmem(struct page_pool *pool,
* allow registering MEM_TYPE_PAGE_POOL, but shield linker.
*/
#ifdef CONFIG_PAGE_POOL
- if (!page_pool_is_last_ref(netmem))
+ if (!page_pool_unref_and_test(netmem))
return;
page_pool_put_unrefed_netmem(pool, netmem, dma_sync_size, allow_direct);
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index e07ad7315955..9733206d6406 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -897,7 +897,7 @@ void page_pool_put_netmem_bulk(netmem_ref *data, u32 count)
for (u32 i = 0; i < count; i++) {
netmem_ref netmem = netmem_compound_head(data[i]);
- if (page_pool_is_last_ref(netmem))
+ if (page_pool_unref_and_test(netmem))
data[bulk_len++] = netmem;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net: page_pool: rename page_pool_is_last_ref()
2024-12-15 21:29 [PATCH net-next v2] net: page_pool: rename page_pool_is_last_ref() Jakub Kicinski
@ 2024-12-16 8:52 ` Jesper Dangaard Brouer
2024-12-18 2:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2024-12-16 8:52 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, Alexander Lobakin, Ilias Apalodimas,
asml.silence, almasrymina
On 15/12/2024 22.29, Jakub Kicinski wrote:
> page_pool_is_last_ref() releases a reference while the name,
> to me at least, suggests it just checks if the refcount is 1.
> The semantics of the function are the same as those of
> atomic_dec_and_test() and refcount_dec_and_test(), so just
> use the _and_test() suffix.
>
> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> Hopefully this doesn't conflict with anyone's work, I've been
> deferring sending this rename forever because I always look
> at it while reviewing an in-flight series and then I'm worried
> it will conflict.
>
> v2:
> - rebased on Olek's changes
> v1: https://lore.kernel.org/20241213153759.3086474-1-kuba@kernel.org
>
> CC: hawk@kernel.org
> CC: ilias.apalodimas@linaro.org
> CC: aleksander.lobakin@intel.com
> CC: asml.silence@gmail.com
> CC: almasrymina@google.com
> ---
> include/net/page_pool/helpers.h | 4 ++--
> net/core/page_pool.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
Looks good to me.
Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
> diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h
> index e555921e5233..776a3008ac28 100644
> --- a/include/net/page_pool/helpers.h
> +++ b/include/net/page_pool/helpers.h
> @@ -306,7 +306,7 @@ static inline void page_pool_ref_page(struct page *page)
> page_pool_ref_netmem(page_to_netmem(page));
> }
>
> -static inline bool page_pool_is_last_ref(netmem_ref netmem)
> +static inline bool page_pool_unref_and_test(netmem_ref netmem)
> {
> /* If page_pool_unref_page() returns 0, we were the last user */
> return page_pool_unref_netmem(netmem, 1) == 0;
> @@ -321,7 +321,7 @@ static inline void page_pool_put_netmem(struct page_pool *pool,
> * allow registering MEM_TYPE_PAGE_POOL, but shield linker.
> */
> #ifdef CONFIG_PAGE_POOL
> - if (!page_pool_is_last_ref(netmem))
> + if (!page_pool_unref_and_test(netmem))
> return;
>
> page_pool_put_unrefed_netmem(pool, netmem, dma_sync_size, allow_direct);
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index e07ad7315955..9733206d6406 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -897,7 +897,7 @@ void page_pool_put_netmem_bulk(netmem_ref *data, u32 count)
> for (u32 i = 0; i < count; i++) {
> netmem_ref netmem = netmem_compound_head(data[i]);
>
> - if (page_pool_is_last_ref(netmem))
> + if (page_pool_unref_and_test(netmem))
> data[bulk_len++] = netmem;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net: page_pool: rename page_pool_is_last_ref()
2024-12-15 21:29 [PATCH net-next v2] net: page_pool: rename page_pool_is_last_ref() Jakub Kicinski
2024-12-16 8:52 ` Jesper Dangaard Brouer
@ 2024-12-18 2:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-18 2:00 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, aleksander.lobakin,
ilias.apalodimas, hawk, asml.silence, almasrymina
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 15 Dec 2024 13:29:38 -0800 you wrote:
> page_pool_is_last_ref() releases a reference while the name,
> to me at least, suggests it just checks if the refcount is 1.
> The semantics of the function are the same as those of
> atomic_dec_and_test() and refcount_dec_and_test(), so just
> use the _and_test() suffix.
>
> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>
> [...]
Here is the summary with links:
- [net-next,v2] net: page_pool: rename page_pool_is_last_ref()
https://git.kernel.org/netdev/net-next/c/d3c9510dc900
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-18 2:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-15 21:29 [PATCH net-next v2] net: page_pool: rename page_pool_is_last_ref() Jakub Kicinski
2024-12-16 8:52 ` Jesper Dangaard Brouer
2024-12-18 2:00 ` patchwork-bot+netdevbpf
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).