[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35ca9ed2-8cce-4dc8-bd15-2cda0b2d2ec5@gmail.com>
Date: Wed, 13 Aug 2025 10:11:36 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
davem@...emloft.net, sdf@...ichev.me, dw@...idwei.uk,
Jesper Dangaard Brouer <hawk@...nel.org>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>,
Byungchul Park <byungchul@...com>
Subject: Re: [RFC net-next v1 5/6] net: page_pool: convert refcounting helpers
to nmdesc
On 8/13/25 01:14, Mina Almasry wrote:
> On Mon, Aug 11, 2025 at 9:28 AM Pavel Begunkov <asml.silence@...il.com> wrote:
...>> -static inline long page_pool_unref_netmem(netmem_ref netmem, long nr)
>> +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)
>> 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
Powered by blists - more mailing lists