netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: duanqiangwen <duanqiangwen@net-swift.com>
Cc: netdev@vger.kernel.org, jiawenwu@trustnetic.com,
	mengyuanlou@net-swift.com, davem@davemloft.net,
	pabeni@redhat.com, yang.lee@linux.alibaba.com,
	shaozhengchao@huawei.com, error27@gmail.com, andrew@lunn.ch,
	stable@vger.kernel.org
Subject: Re: [PATCH net v2] net: libwx: fix memory leak on free page
Date: Mon, 11 Dec 2023 19:01:16 -0800	[thread overview]
Message-ID: <20231211190116.5415a79a@kernel.org> (raw)
In-Reply-To: <20231208080216.20176-1-duanqiangwen@net-swift.com>

On Fri,  8 Dec 2023 16:02:16 +0800 duanqiangwen wrote:
> ifconfig ethx up, will set page->refcount larger than 1,
> and then ifconfig ethx down, calling __page_frag_cache_drain()
> to free pages, it is not compatible with page pool.
> So deleting codes which changing page->refcount.
> 
> Fixes: 3c47e8ae113a ("net: libwx: Support to receive packets in NAPI")
> 
> Signed-off-by: duanqiangwen <duanqiangwen@net-swift.com>

nit: no empty line between Fixes and Signed-off-by, please fix and
repost

> @@ -335,11 +269,12 @@ static struct sk_buff *wx_build_skb(struct wx_ring *rx_ring,
>  		if (size <= WX_RXBUFFER_256) {
>  			memcpy(__skb_put(skb, size), page_addr,
>  			       ALIGN(size, sizeof(long)));
> -			rx_buffer->pagecnt_bias++;
> -
> +			page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, false);

FWIW I'm 90% sure you can pass true as the last argument here.
The rule for "allow direct recycling" is basically - are you
in the same context the context which will allocate from this
page pool.
-- 
pw-bot: cr

      reply	other threads:[~2023-12-12  3:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  8:02 [PATCH net v2] net: libwx: fix memory leak on free page duanqiangwen
2023-12-12  3:01 ` Jakub Kicinski [this message]

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=20231211190116.5415a79a@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=duanqiangwen@net-swift.com \
    --cc=error27@gmail.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaozhengchao@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=yang.lee@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).