netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Mina Almasry <almasrymina@google.com>
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	davem@davemloft.net, sdf@fomichev.me, dw@davidwei.uk,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Byungchul Park <byungchul@sk.com>
Subject: Re: [RFC net-next v1 5/6] net: page_pool: convert refcounting helpers to nmdesc
Date: Wed, 13 Aug 2025 10:11:36 +0100	[thread overview]
Message-ID: <35ca9ed2-8cce-4dc8-bd15-2cda0b2d2ec5@gmail.com> (raw)
In-Reply-To: <CAHS8izOMhPLOGgxxWdQgx-FgAmbsUj=j7fEAZBRo1=Z4W=zYFg@mail.gmail.com>

On 8/13/25 01:14, Mina Almasry wrote:
> On Mon, Aug 11, 2025 at 9:28 AM Pavel Begunkov <asml.silence@gmail.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


  reply	other threads:[~2025-08-13  9:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 16:29 [RFC net-next v1 0/6] nmdesc cleanups and optimisations Pavel Begunkov
2025-08-11 16:29 ` [RFC net-next v1 1/6] net: move pp_page_to_nmdesc() Pavel Begunkov
2025-08-12 23:55   ` Mina Almasry
2025-08-11 16:29 ` [RFC net-next v1 2/6] net: replace __netmem_clear_lsb() with netmem_to_nmdesc() Pavel Begunkov
2025-08-11 16:29 ` [RFC net-next v1 3/6] net: page_pool: remove page_pool_set_dma_addr() Pavel Begunkov
2025-08-13  0:00   ` Mina Almasry
2025-08-11 16:29 ` [RFC net-next v1 4/6] net: convert page pool dma helpers to netmem_desc Pavel Begunkov
2025-08-13  0:05   ` Mina Almasry
2025-08-13  8:34     ` Pavel Begunkov
2025-08-11 16:29 ` [RFC net-next v1 5/6] net: page_pool: convert refcounting helpers to nmdesc Pavel Begunkov
2025-08-13  0:14   ` Mina Almasry
2025-08-13  9:11     ` Pavel Begunkov [this message]
2025-08-13 16:55       ` Mina Almasry
2025-08-14  8:43         ` Pavel Begunkov
2025-08-11 16:29 ` [RFC net-next v1 6/6] io_uring/zcrx: avoid netmem casts with nmdesc Pavel Begunkov
2025-08-13  0:16   ` Mina Almasry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35ca9ed2-8cce-4dc8-bd15-2cda0b2d2ec5@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=almasrymina@google.com \
    --cc=byungchul@sk.com \
    --cc=davem@davemloft.net \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).