mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
net: page_pool: rename page_pool_is_last_ref()
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> Acked-by: Jesper Dangaard Brouer <hawk@kernel.org> Link: https://patch.msgid.link/20241215212938.99210-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d22f955cc2
commit
d3c9510dc9
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user