Skip to contentSkip to conversation

iommu/pages: use folio_nr_pages() instead of shift operation

PATCH Applied Pedro Demarchi Gomes 3 participants 3 messages Oct 4, 2025 – Oct 27, 2025 IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/pages: use folio_nr_pages() instead of shift operation

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

---
 drivers/iommu/iommu-pages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu-pages.c +1 -1
index 238c09e5166b..3cb8fcc39066 100644
@@ -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);
Signature · 1 line
2.39.5