[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2d184613-657e-4aab-8395-336b7764d1d7@gmail.com>
Date: Thu, 14 Aug 2025 09:43:10 +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 17:55, Mina Almasry wrote:
> On Wed, Aug 13, 2025 at 2:10 AM Pavel Begunkov <asml.silence@...il.com> wrote:
>> ...>> 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.
>>
>
> Ack. I also agree the WARN_ON_ONCE is not necessary, even the one
> above it for the net_iov check is not necessary.
>
> But since devmem was the first memory provider I'm paranoid that I got
> something wrong in the general memory provider infra or in the devmem
> implementation specifically; I think some paranoid WARN_ON_ONCEs are
> justified, maybe. I'd rather debug the warning firing rather than a
> very subtle refcounting issue or provider mixup or something at a
> later point. I'm still surprised there aren't many bug reports about
> any memory providers. They probably aren't used much in production
> yet.
>
> I think after 2025 or 2026 LTS it's probably time to clean up these
> unnecessary WARN_ONs, but until then, let's keep them in if you don't
> mind.
No problem, thanks for the review!
--
Pavel Begunkov
Powered by blists - more mailing lists