netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Fomichev <stfomichev@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	David Wei <dw@davidwei.uk>,
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	hawk@kernel.org, ilias.apalodimas@linaro.org,
	almasrymina@google.com, sdf@fomichev.me
Subject: Re: [PATCH net] net: page_pool: allow enabling recycling late, fix false positive warning
Date: Fri, 1 Aug 2025 14:36:21 -0700	[thread overview]
Message-ID: <aI0zVd1QJ-CMVX3u@mini-arch> (raw)
In-Reply-To: <20250801140506.5b3e7213@kernel.org>

On 08/01, Jakub Kicinski wrote:
> On Fri, 1 Aug 2025 13:55:09 -0700 Stanislav Fomichev wrote:
> > > +static void bnxt_enable_rx_page_pool(struct bnxt_rx_ring_info *rxr)
> > > +{
> > > +	page_pool_enable_direct_recycling(rxr->head_pool, &rxr->bnapi->napi);
> > > +	page_pool_enable_direct_recycling(rxr->page_pool, &rxr->bnapi->napi);  
> > 
> > We do bnxt_separate_head_pool check for the disable_direct_recycling
> > of head_pool. Is it safe to skip the check here because we always allocate two
> > pps from queue_mgmt callbacks? (not clear for me from a quick glance at
> > bnxt_alloc_rx_page_pool)
> 
> It's safe (I hope) because the helper is duplicate-call-friendly:
> 
> +void page_pool_enable_direct_recycling(struct page_pool *pool,
> +				       struct napi_struct *napi)
> +{
> +	if (READ_ONCE(pool->p.napi) == napi)   <<< right here
> +		return;
> +	WARN_ON_ONCE(!napi || pool->p.napi);
> +
> +	mutex_lock(&page_pools_lock);
> +	WRITE_ONCE(pool->p.napi, napi);
> +	mutex_unlock(&page_pools_lock);
> +}
> 
> We already have a refcount in page pool, I'm planning to add
> page_pool_get() in net-next and remove the
> 
> 	if (bnxt_separate_head_pool)
> 
> before page_pool_destroy(), too.

Ah, I see, I missed that fact that page_pool and head_pool point to the
same address when we don't have separate pools. Makes sense, thanks!

  reply	other threads:[~2025-08-01 21:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01 17:30 [PATCH net] net: page_pool: allow enabling recycling late, fix false positive warning Jakub Kicinski
2025-08-01 20:55 ` Stanislav Fomichev
2025-08-01 21:05   ` Jakub Kicinski
2025-08-01 21:36     ` Stanislav Fomichev [this message]
2025-08-04 14:17       ` Jesper Dangaard Brouer

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=aI0zVd1QJ-CMVX3u@mini-arch \
    --to=stfomichev@gmail.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.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).