diff mbox series

[v2,16/24] page_pool: Use netmem in page_pool_drain_frag()

Message ID 20230105214631.3939268-17-willy@infradead.org (mailing list archive)
State New
Headers show
Series Split netmem from struct page | expand

Commit Message

Matthew Wilcox Jan. 5, 2023, 9:46 p.m. UTC
We're not quite ready to change the API of page_pool_drain_frag(),
but we can remove the use of several wrappers by using the netmem
throughout.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 net/core/page_pool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jesper Dangaard Brouer Jan. 6, 2023, 3:30 p.m. UTC | #1
On 05/01/2023 22.46, Matthew Wilcox (Oracle) wrote:
> We're not quite ready to change the API of page_pool_drain_frag(),
> but we can remove the use of several wrappers by using the netmem
> throughout.
> 
> Signed-off-by: Matthew Wilcox (Oracle)<willy@infradead.org>
> ---
>   net/core/page_pool.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Ilias Apalodimas Jan. 10, 2023, 11 a.m. UTC | #2
On Thu, Jan 05, 2023 at 09:46:23PM +0000, Matthew Wilcox (Oracle) wrote:
> We're not quite ready to change the API of page_pool_drain_frag(),
> but we can remove the use of several wrappers by using the netmem
> throughout.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  net/core/page_pool.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index c495e3a16e83..cd469a9970e7 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -672,17 +672,17 @@ static struct page *page_pool_drain_frag(struct page_pool *pool,
>  	long drain_count = BIAS_MAX - pool->frag_users;
>
>  	/* Some user is still using the page frag */
> -	if (likely(page_pool_defrag_page(page, drain_count)))
> +	if (likely(page_pool_defrag_netmem(nmem, drain_count)))
>  		return NULL;
>
> -	if (page_ref_count(page) == 1 && !page_is_pfmemalloc(page)) {
> +	if (netmem_ref_count(nmem) == 1 && !netmem_is_pfmemalloc(nmem)) {
>  		if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
>  			page_pool_dma_sync_for_device(pool, nmem, -1);
>
>  		return page;
>  	}
>
> -	page_pool_return_page(pool, page);
> +	page_pool_return_netmem(pool, nmem);
>  	return NULL;
>  }
>
> --
> 2.35.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index c495e3a16e83..cd469a9970e7 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -672,17 +672,17 @@  static struct page *page_pool_drain_frag(struct page_pool *pool,
 	long drain_count = BIAS_MAX - pool->frag_users;
 
 	/* Some user is still using the page frag */
-	if (likely(page_pool_defrag_page(page, drain_count)))
+	if (likely(page_pool_defrag_netmem(nmem, drain_count)))
 		return NULL;
 
-	if (page_ref_count(page) == 1 && !page_is_pfmemalloc(page)) {
+	if (netmem_ref_count(nmem) == 1 && !netmem_is_pfmemalloc(nmem)) {
 		if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
 			page_pool_dma_sync_for_device(pool, nmem, -1);
 
 		return page;
 	}
 
-	page_pool_return_page(pool, page);
+	page_pool_return_netmem(pool, nmem);
 	return NULL;
 }