summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/pgtable.h14
-rw-r--r--mm/memory.c13
-rw-r--r--mm/mm_init.c10
3 files changed, 11 insertions, 26 deletions
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index a50df42a893f..5e772599d9a5 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -1917,7 +1917,6 @@ static inline void pfnmap_setup_cachemode_pfn(unsigned long pfn, pgprot_t *prot)
pfnmap_setup_cachemode(pfn, PAGE_SIZE, prot);
}
-#ifdef CONFIG_MMU
#ifdef __HAVE_COLOR_ZERO_PAGE
static inline int is_zero_pfn(unsigned long pfn)
{
@@ -1940,18 +1939,7 @@ static inline unsigned long my_zero_pfn(unsigned long addr)
extern unsigned long zero_pfn;
return zero_pfn;
}
-#endif
-#else
-static inline int is_zero_pfn(unsigned long pfn)
-{
- return 0;
-}
-
-static inline unsigned long my_zero_pfn(unsigned long addr)
-{
- return 0;
-}
-#endif /* CONFIG_MMU */
+#endif /* __HAVE_COLOR_ZERO_PAGE */
#ifdef CONFIG_MMU
diff --git a/mm/memory.c b/mm/memory.c
index 7084c426f933..6b504fc5e815 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -162,21 +162,8 @@ static int __init disable_randmaps(char *s)
}
__setup("norandmaps", disable_randmaps);
-unsigned long zero_pfn __read_mostly;
-EXPORT_SYMBOL(zero_pfn);
-
unsigned long highest_memmap_pfn __read_mostly;
-/*
- * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init()
- */
-static int __init init_zero_pfn(void)
-{
- zero_pfn = page_to_pfn(ZERO_PAGE(0));
- return 0;
-}
-early_initcall(init_zero_pfn);
-
void mm_trace_rss_stat(struct mm_struct *mm, int member)
{
trace_rss_stat(mm, member);
diff --git a/mm/mm_init.c b/mm/mm_init.c
index df34797691bd..f3755a66b9d0 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -53,6 +53,9 @@ EXPORT_SYMBOL(mem_map);
void *high_memory;
EXPORT_SYMBOL(high_memory);
+unsigned long zero_pfn __ro_after_init;
+EXPORT_SYMBOL(zero_pfn);
+
#ifdef CONFIG_DEBUG_MEMORY_INIT
int __meminitdata mminit_loglevel;
@@ -2672,6 +2675,13 @@ static void __init mem_init_print_info(void)
);
}
+static int __init init_zero_pfn(void)
+{
+ zero_pfn = page_to_pfn(ZERO_PAGE(0));
+ return 0;
+}
+early_initcall(init_zero_pfn);
+
void __init __weak arch_mm_preinit(void)
{
}