public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Gospodarek <andrew.gospodarek@broadcom.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, somnath.kotur@broadcom.com,
	andrew.gospodarek@broadcom.com, michael.chan@broadcom.com
Subject: Re: [PATCH net] bnxt: make sure we return pages to the pool
Date: Wed, 11 Jan 2023 09:22:40 -0500	[thread overview]
Message-ID: <Y77GMD58O1CktpI+@C02YVCJELVCG> (raw)
In-Reply-To: <20230111042547.987749-1-kuba@kernel.org>

On Tue, Jan 10, 2023 at 08:25:47PM -0800, Jakub Kicinski wrote:
> Before the commit under Fixes the page would have been released
> from the pool before the napi_alloc_skb() call, so normal page
> freeing was fine (released page == no longer in the pool).
> 
> After the change we just mark the page for recycling so it's still
> in the pool if the skb alloc fails, we need to recycle.
> 
> Same commit added the same bug in the new bnxt_rx_multi_page_skb().

Good catch, thank you.

> Fixes: 1dc4c557bfed ("bnxt: adding bnxt_xdp_build_skb to build skb from multibuffer xdp_buff")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>

> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 16ce7a90610c..240a7e8a7652 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -993,7 +993,7 @@ static struct sk_buff *bnxt_rx_multi_page_skb(struct bnxt *bp,
>  			     DMA_ATTR_WEAK_ORDERING);
>  	skb = build_skb(page_address(page), PAGE_SIZE);
>  	if (!skb) {
> -		__free_page(page);
> +		page_pool_recycle_direct(rxr->page_pool, page);
>  		return NULL;
>  	}
>  	skb_mark_for_recycle(skb);
> @@ -1031,7 +1031,7 @@ static struct sk_buff *bnxt_rx_page_skb(struct bnxt *bp,
>  
>  	skb = napi_alloc_skb(&rxr->bnapi->napi, payload);
>  	if (!skb) {
> -		__free_page(page);
> +		page_pool_recycle_direct(rxr->page_pool, page);
>  		return NULL;
>  	}
>  
> -- 
> 2.38.1
> 

  reply	other threads:[~2023-01-11 14:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11  4:25 [PATCH net] bnxt: make sure we return pages to the pool Jakub Kicinski
2023-01-11 14:22 ` Andy Gospodarek [this message]
2023-01-12  5:00 ` patchwork-bot+netdevbpf

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=Y77GMD58O1CktpI+@C02YVCJELVCG \
    --to=andrew.gospodarek@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=somnath.kotur@broadcom.com \
    /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