]> www.infradead.org Git - users/willy/linux.git/commitdiff
mm: Convert page_to_section() to pgflags_section()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 29 Sep 2021 14:20:00 +0000 (10:20 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 3 Oct 2021 10:56:47 +0000 (06:56 -0400)
Pass the page->flags to this function instead of the struct page.
This is in preparation for splitting struct page into separate types.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
include/asm-generic/memory_model.h
include/linux/mm.h
mm/sparse.c

index a2c8ed60233a4120e1a197f7e28332598c14db48..ee9c285f5af208a8edbb4d6556d0ad4ed5199836 100644 (file)
@@ -32,7 +32,7 @@
  */
 #define __page_to_pfn(pg)                                      \
 ({     const struct page *__pg = (pg);                         \
-       int __sec = page_to_section(__pg);                      \
+       int __sec = pgflags_section(__pg->flags);                       \
        (unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \
 })
 
index 73a52aba448f940cb3b0574d61729c4436853a5e..db63653f403c1e109426a8f1131f9d0e1d57a6f0 100644 (file)
@@ -1553,9 +1553,9 @@ static inline void set_page_section(struct page *page, unsigned long section)
        page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
 }
 
-static inline unsigned long page_to_section(const struct page *page)
+static inline unsigned long pgflags_section(unsigned long pgflags)
 {
-       return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
+       return (flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
 }
 #endif
 
index 120bc8ea5293e60bcb5dd91f22467767dd959892..4c59ed8c1d5ac9902e6c18f5489393a40c4456a1 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[pgflags_section(page->flags)];
 }
 EXPORT_SYMBOL(page_to_nid);