public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/pages: use folio_nr_pages() instead of shift operation
@ 2025-10-04  3:23 Pedro Demarchi Gomes
  2025-10-06 12:28 ` Jason Gunthorpe
  2025-10-27 11:47 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Pedro Demarchi Gomes @ 2025-10-04  3:23 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: Robin Murphy, iommu, 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>
---
 drivers/iommu/iommu-pages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu-pages.c b/drivers/iommu/iommu-pages.c
index 238c09e5166b..3cb8fcc39066 100644
--- a/drivers/iommu/iommu-pages.c
+++ b/drivers/iommu/iommu-pages.c
@@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(iommu_alloc_pages_node_sz);
 static void __iommu_free_desc(struct ioptdesc *iopt)
 {
 	struct folio *folio = ioptdesc_folio(iopt);
-	const unsigned long pgcnt = 1UL << folio_order(folio);
+	const unsigned long pgcnt = folio_nr_pages(folio);
 
 	mod_node_page_state(folio_pgdat(folio), NR_IOMMU_PAGES, -pgcnt);
 	lruvec_stat_mod_folio(folio, NR_SECONDARY_PAGETABLE, -pgcnt);
-- 
2.39.5


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-04  3:23 [PATCH] iommu/pages: use folio_nr_pages() instead of shift operation Pedro Demarchi Gomes
2025-10-06 12:28 ` Jason Gunthorpe
2025-10-27 11:47 ` Joerg Roedel

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