]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: convert page_to_section() to memdesc_section()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 5 Aug 2025 17:22:52 +0000 (18:22 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:06 +0000 (17:25 -0700)
Pass in the memdesc_flags_t instead of a pointer to the page.  This will
allow us to remove a few conversions to struct page in upcoming patches.

Link: https://lkml.kernel.org/r/20250805172307.1302730-3-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/asm-generic/memory_model.h
include/linux/mm.h
mm/sparse.c

index 74d0077cc5faa9beb5efe4b134e71777aba8434b..efa6610acbc7973105a6cf63408f8f7d0cbf7c75 100644 (file)
@@ -53,7 +53,7 @@ static inline int pfn_valid(unsigned long pfn)
  */
 #define __page_to_pfn(pg)                                      \
 ({     const struct page *__pg = (pg);                         \
-       int __sec = page_to_section(__pg);                      \
+       int __sec = memdesc_section(__pg->flags);               \
        (unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \
 })
 
index da562f23f50ce3e08b20222c241d8fc97d8b0854..82617c4cfa240b94f28eae376a38d46c758717ab 100644 (file)
@@ -1808,9 +1808,9 @@ static inline void set_page_section(struct page *page, unsigned long section)
        page->flags.f |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
 }
 
-static inline unsigned long page_to_section(const struct page *page)
+static inline unsigned long memdesc_section(memdesc_flags_t mdf)
 {
-       return (page->flags.f >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
+       return (mdf.f >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
 }
 #endif
 
index e6075b62240707dc77133f71bd13ae583fad045d..7cb42cbfc7f9cf79f921e8ae00611fb80c623624 100644 (file)
@@ -45,7 +45,7 @@ static u16 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned;
 
 int page_to_nid(const struct page *page)
 {
-       return section_to_node_table[page_to_section(page)];
+       return section_to_node_table[memdesc_section(page->flags)];
 }
 EXPORT_SYMBOL(page_to_nid);