Subject: Re: [RFC net-next 1/2] page_pool: allow caching from safely localized NAPI

From: Jakub Kicinski <[email-masked]>
Date: Mon, 3 Apr 2023 08:05:45 -0700

On Mon, 3 Apr 2023 12:16:04 +0300 Ilias Apalodimas wrote:
> >  /* If the page refcnt == 1, this will try to recycle the page.
> >   * if PP_FLAG_DMA_SYNC_DEV is set, we'll try to sync the DMA area for
> >   * the configured size min(dma_sync_size, pool->max_len).
> > @@ -570,6 +583,9 @@ __page_pool_put_page(struct page_pool *pool, struct page *page,
> >  			page_pool_dma_sync_for_device(pool, page,
> >  						      dma_sync_size);
> >
> > +		if (!allow_direct)
> > +			allow_direct = page_pool_safe_producer(pool);
> > +  
> 
> Do we want to hide the decision in __page_pool_put_page().  IOW wouldn't it
> be better for this function to honor whatever allow_direct dictates and
> have the allow_direct = page_pool_safe_producer(pool); in callers?

Meaning in page_pool_return_skb_page() or all the way from
napi_consume_skb()? The former does indeed sounds like a good idea!