public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring/zcrx: use folio_nr_pages() instead of shift operation
@ 2025-10-04  3:07 Pedro Demarchi Gomes
  2025-10-07 11:13 ` Pavel Begunkov
  0 siblings, 1 reply; 2+ messages in thread
From: Pedro Demarchi Gomes @ 2025-10-04  3:07 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, linux-kernel, Pedro Demarchi Gomes

folio_nr_pages() is a faster helper function to get the number of pages when
NR_PAGES_IN_LARGE_FOLIO is enabled.

Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
---
 io_uring/zcrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index e5ff49f3425e..97fda3d65919 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -172,7 +172,7 @@ static unsigned long io_count_account_pages(struct page **pages, unsigned nr_pag
 		if (folio == last_folio)
 			continue;
 		last_folio = folio;
-		res += 1UL << folio_order(folio);
+		res += folio_nr_pages(folio);
 	}
 	return res;
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring/zcrx: use folio_nr_pages() instead of shift operation
  2025-10-04  3:07 [PATCH] io_uring/zcrx: use folio_nr_pages() instead of shift operation Pedro Demarchi Gomes
@ 2025-10-07 11:13 ` Pavel Begunkov
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2025-10-07 11:13 UTC (permalink / raw)
  To: Pedro Demarchi Gomes, Jens Axboe; +Cc: io-uring, linux-kernel

On 10/4/25 04:07, Pedro Demarchi Gomes wrote:
> folio_nr_pages() is a faster helper function to get the number of pages when
> NR_PAGES_IN_LARGE_FOLIO is enabled.

Looks straightforward, I'll take it into a branch.

> Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
> ---
>   io_uring/zcrx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
> index e5ff49f3425e..97fda3d65919 100644
> --- a/io_uring/zcrx.c
> +++ b/io_uring/zcrx.c
> @@ -172,7 +172,7 @@ static unsigned long io_count_account_pages(struct page **pages, unsigned nr_pag
>   		if (folio == last_folio)
>   			continue;
>   		last_folio = folio;
> -		res += 1UL << folio_order(folio);
> +		res += folio_nr_pages(folio);
>   	}
>   	return res;
>   }

-- 
Pavel Begunkov


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-07 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-04  3:07 [PATCH] io_uring/zcrx: use folio_nr_pages() instead of shift operation Pedro Demarchi Gomes
2025-10-07 11:13 ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox