Skip to contentSkip to conversation

Support HIGHMEM pages in vmap_pages_range_noflush()

PATCH Applied Matthew Wilcox 2 participants 2 messages Aug 18, 2022 – Aug 19, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support HIGHMEM pages in vmap_pages_range_noflush()

If the pages being mapped are in HIGHMEM, page_address() returns NULL. This probably wasn't noticed before because there aren't currently any architectures with HAVE_ARCH_HUGE_VMALLOC and HIGHMEM, but it's simpler to call page_to_phys() and futureproofs us against such configurations existing.

Fixes 121e6f3258fe ("mm/vmalloc: hugepage vmalloc mappings")
mm/vmalloc.c +1 -1
index dd6cdb201195..bea9b0c37295 100644
@@ -590,7 +590,7 @@ int vmap_pages_range_noflush(unsigned long addr, unsigned long end,
 		int err;
 
 		err = vmap_range_noflush(addr, addr + (1UL << page_shift),
-					__pa(page_address(pages[i])), prot,
+					page_to_phys(pages[i]), prot,
 					page_shift);
 		if (err)
 			return err;
Reviewed-by on v1 1/1
#1 lore raw

Looks good and IMHO it's more self-documenting.

Quoted 25 lines · Matthew Wilcox

If the pages being mapped are in HIGHMEM, page_address() returns NULL. This probably wasn't noticed before because there aren't currently any architectures with HAVE_ARCH_HUGE_VMALLOC and HIGHMEM, but it's simpler to call page_to_phys() and futureproofs us against such configurations existing.

Fixes 121e6f3258fe ("mm/vmalloc: hugepage vmalloc mappings")
mm/vmalloc.c +1 -1
index dd6cdb201195..bea9b0c37295 100644
@@ -590,7 +590,7 @@ int vmap_pages_range_noflush(unsigned long addr, unsigned long end,
 int err;
 
 err = vmap_range_noflush(addr, addr + (1UL << page_shift),
- __pa(page_address(pages[i])), prot,
+ page_to_phys(pages[i]), prot,
 page_shift);
 if (err)
 return err;