Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+3 -3
+2 -2
include/net/page_pool/helpers.h
··· 306 306 page_pool_ref_netmem(page_to_netmem(page)); 307 307 } 308 308 309 - static inline bool page_pool_is_last_ref(netmem_ref netmem) 309 + static inline bool page_pool_unref_and_test(netmem_ref netmem) 310 310 { 311 311 /* If page_pool_unref_page() returns 0, we were the last user */ 312 312 return page_pool_unref_netmem(netmem, 1) == 0; ··· 321 321 * allow registering MEM_TYPE_PAGE_POOL, but shield linker. 322 322 */ 323 323 #ifdef CONFIG_PAGE_POOL 324 - if (!page_pool_is_last_ref(netmem)) 324 + if (!page_pool_unref_and_test(netmem)) 325 325 return; 326 326 327 327 page_pool_put_unrefed_netmem(pool, netmem, dma_sync_size, allow_direct);
+1 -1
net/core/page_pool.c
··· 897 897 for (u32 i = 0; i < count; i++) { 898 898 netmem_ref netmem = netmem_compound_head(data[i]); 899 899 900 - if (page_pool_is_last_ref(netmem)) 900 + if (page_pool_unref_and_test(netmem)) 901 901 data[bulk_len++] = netmem; 902 902 } 903 903