From: Matthew Wilcox (Oracle) Date: Wed, 29 Sep 2021 14:20:00 +0000 (-0400) Subject: mm: Convert page_to_section() to pgflags_section() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c2e423e613da5e5c97af40336a219033d0f16581;p=users%2Fwilly%2Flinux.git mm: Convert page_to_section() to pgflags_section() 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) --- diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index a2c8ed60233a4..ee9c285f5af20 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h @@ -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))); \ }) diff --git a/include/linux/mm.h b/include/linux/mm.h index 73a52aba448f9..db63653f403c1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -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 diff --git a/mm/sparse.c b/mm/sparse.c index 120bc8ea5293e..4c59ed8c1d5ac 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -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);