Re: [RFC net-next v1 5/6] net: page_pool: convert refcounting helpers to nmdesc
From: Pavel Begunkov <asml.silence@gmail.com>
Date: 2025-08-13 09:10:20
On 8/13/25 01:14, Mina Almasry wrote:
On Mon, Aug 11, 2025 at 9:28 AM Pavel Begunkov [off-list ref] wrote:
...>> -static inline long page_pool_unref_netmem(netmem_ref netmem, long nr)
quoted
+static inline long page_pool_unref_nmdesc(struct netmem_desc *desc, long nr) { - atomic_long_t *pp_ref_count = netmem_get_pp_ref_count_ref(netmem); + atomic_long_t *pp_ref_count = &desc->pp_ref_count;nit: I think we can also kill the pp_ref_count local var and use desc->pp_ref_count directly.
I stopped there to save the churn, I'd rather have it on top and outside of cross tree branches. But I agree in general, and there is more that we can do as well. ...>> static inline bool page_pool_unref_and_test(netmem_ref netmem)
quoted
diff --git a/net/core/devmem.c b/net/core/devmem.c index 24c591ab38ae..e084dad11506 100644 --- a/net/core/devmem.c +++ b/net/core/devmem.c@@ -440,14 +440,9 @@ void mp_dmabuf_devmem_destroy(struct page_pool *pool) bool mp_dmabuf_devmem_release_page(struct page_pool *pool, netmem_ref netmem) { - long refcount = atomic_long_read(netmem_get_pp_ref_count_ref(netmem)); - if (WARN_ON_ONCE(!netmem_is_net_iov(netmem))) return false; - if (WARN_ON_ONCE(refcount != 1)) - return false; -Rest of the patch looks good to me, but this comes across as a completely unrelated clean up/change or something? Lets keep the WARN_ON_ONCE?
I was killing netmem_get_pp_ref_count_ref(), which is why it's here. It checks an assumption that's guaranteed by page pools and shared with non-mp pools, so not like devmem needs it, and it'd not catch any recycling problems either. Regardless, I can leave the warning. -- Pavel Begunkov