Convert page_to_nid() into a wrapper around pgflags_nid(). This is in preparation for splitting struct page into separate types. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- include/linux/mm.h | 12 ++++++++---- mm/sparse.c | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index db63653f403c..adc7e843148b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1369,16 +1369,20 @@ static inline int page_zone_id(struct page *page) } #ifdef NODE_NOT_IN_PAGE_FLAGS -extern int page_to_nid(const struct page *page); +extern int pgflags_nid(unsigned long pgflags); #else +static inline int pgflags_nid(unsigned long pgflags) +{ + return (pgflags >> NODES_PGSHIFT) & NODES_MASK; +} +#endif + static inline int page_to_nid(const struct page *page) { struct page *p = (struct page *)page; - return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK; + return pgflags_nid(PF_POISONED_CHECK(p)->flags); } -#endif - #ifdef CONFIG_NUMA_BALANCING static inline int cpu_pid_to_cpupid(int cpu, int pid) { diff --git a/mm/sparse.c b/mm/sparse.c index 4c59ed8c1d5a..818bdb84be99 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -43,11 +43,11 @@ static u8 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned; static u16 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned; #endif -int page_to_nid(const struct page *page) +int pgflags_nid(unsigned long pgflags) { - return section_to_node_table[pgflags_section(page->flags)]; + return section_to_node_table[pgflags_section(pgflags)]; } -EXPORT_SYMBOL(page_to_nid); +EXPORT_SYMBOL(pgflags_nid); static void set_section_nid(unsigned long section_nr, int nid) { -- 2.32.0