]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: introduce memdesc_zonenum()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 5 Aug 2025 17:22:54 +0000 (18:22 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:07 +0000 (17:25 -0700)
Remove a conversion from folio to page by passing the folio->flags (which
are a copy of the page->flags) to the new memdesc_zonenum() function.

Link: https://lkml.kernel.org/r/20250805172307.1302730-5-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mmzone.h

index 990560cd99ee2381df8b7a301349c58d0f025c2f..80a3b6642603d4ae52e0b1fa2c512d3fe9c8736b 100644 (file)
@@ -1183,15 +1183,20 @@ static inline bool zone_is_empty(struct zone *zone)
 #define KASAN_TAG_MASK         ((1UL << KASAN_TAG_WIDTH) - 1)
 #define ZONEID_MASK            ((1UL << ZONEID_SHIFT) - 1)
 
+static inline enum zone_type memdesc_zonenum(memdesc_flags_t flags)
+{
+       ASSERT_EXCLUSIVE_BITS(flags.f, ZONES_MASK << ZONES_PGSHIFT);
+       return (flags.f >> ZONES_PGSHIFT) & ZONES_MASK;
+}
+
 static inline enum zone_type page_zonenum(const struct page *page)
 {
-       ASSERT_EXCLUSIVE_BITS(page->flags, ZONES_MASK << ZONES_PGSHIFT);
-       return (page->flags.f >> ZONES_PGSHIFT) & ZONES_MASK;
+       return memdesc_zonenum(page->flags);
 }
 
 static inline enum zone_type folio_zonenum(const struct folio *folio)
 {
-       return page_zonenum(&folio->page);
+       return memdesc_zonenum(folio->flags);
 }
 
 #ifdef CONFIG_ZONE_DEVICE