[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <12edd3e450e3dd596e3048609455bfc295e37dee.camel@gmail.com>
Date: Fri, 02 Dec 2022 13:25:55 -0800
From: Alexander H Duyck <alexander.duyck@...il.com>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>
Cc: netdev@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 11/24] page_pool: Convert page_pool_empty_ring() to use
netmem
On Wed, 2022-11-30 at 22:07 +0000, Matthew Wilcox (Oracle) wrote:
> Retrieve a netmem from the ptr_ring instead of a page.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> ---
> net/core/page_pool.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index e727a74504c2..7a77e3220205 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -755,16 +755,16 @@ EXPORT_SYMBOL(page_pool_alloc_frag);
>
> static void page_pool_empty_ring(struct page_pool *pool)
> {
> - struct page *page;
> + struct netmem *nmem;
>
> /* Empty recycle ring */
> - while ((page = ptr_ring_consume_bh(&pool->ring))) {
> + while ((nmem = ptr_ring_consume_bh(&pool->ring)) != NULL) {
> /* Verify the refcnt invariant of cached pages */
> - if (!(page_ref_count(page) == 1))
> + if (!(netmem_ref_count(nmem) == 1))
One minor code nit here is that this could just be:
if (netmem_ref_count(nmem) != 1)
> pr_crit("%s() page_pool refcnt %d violation\n",
> - __func__, page_ref_count(page));
> + __func__, netmem_ref_count(nmem));
>
> - page_pool_return_page(pool, page);
> + page_pool_return_netmem(pool, nmem);
> }
> }
>
Powered by blists - more mailing lists