aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2021-08-11 10:50:11 +0200
committerIngo Molnar <mingo@kernel.org>2022-03-15 12:57:31 +0100
commit5618dc1443ea8ee1ccb8e62fa83ad1d987c232eb (patch)
treed43d4855b3ce2a5679d23cc79715f1562f2cff7f
parentd463c9e4ef1b867ad6dce83e8d4515f5e3936069 (diff)
downloadtip-5618dc1443ea8ee1ccb8e62fa83ad1d987c232eb.tar.gz
headers/deps: mm: Implement better CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP header hell quirks
CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP's definitions have a couple of historic layering violations, such as the reliance on __pfn_to_section() or page_to_section(), which are defined in a high-level header: <linux/mmzone_api.h>. Remove the linux/mmzone_api.h quirk from <asm-generic/memory_model.h> and move it to higher level headers, as memory_model.h is included in low level headers on most architectures that use SPARSEMEM memory model, and the inclusion of <linux/mmzone_api.h> causes header dependency hell. The most popular configurations of the biggest architectures are free of this quirk. Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/sparc/include/asm/pgalloc_64.h3
-rw-r--r--include/linux/highmem-internal.h11
-rw-r--r--include/linux/mm_page_address.h9
-rw-r--r--include/linux/pgtable_api.h11
-rw-r--r--include/xen/page.h11
5 files changed, 44 insertions, 1 deletions
diff --git a/arch/sparc/include/asm/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h
index 6592bff76840e..90a1a2ca769d1 100644
--- a/arch/sparc/include/asm/pgalloc_64.h
+++ b/arch/sparc/include/asm/pgalloc_64.h
@@ -71,9 +71,10 @@ void pte_free(struct mm_struct *mm, pgtable_t ptepage);
void pgtable_free(void *table, bool is_page);
+struct mmu_gather;
+
#ifdef CONFIG_SMP
-struct mmu_gather;
void tlb_remove_table(struct mmu_gather *, void *);
static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page)
diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h
index 1617394197efd..afa4928f26cc2 100644
--- a/include/linux/highmem-internal.h
+++ b/include/linux/highmem-internal.h
@@ -2,6 +2,17 @@
#ifndef _LINUX_HIGHMEM_INTERNAL_H
#define _LINUX_HIGHMEM_INTERNAL_H
+/*
+ * CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP's definitions in <asm-generic/memory_model.h>
+ * have a couple of layering violations, such as the reliance on __pfn_to_section() or
+ * page_to_section(), * which are defined in a high-level header (linux/mmzone_api.h).
+ *
+ * Include the high level header as a quirk:
+ */
+#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
+# include <linux/mmzone_api.h>
+#endif
+
#include <linux/mm_page_address.h>
#include <linux/pgtable_api.h>
#include <linux/sched/per_task.h>
diff --git a/include/linux/mm_page_address.h b/include/linux/mm_page_address.h
index 8a40cf6c94424..91a3779e4b36c 100644
--- a/include/linux/mm_page_address.h
+++ b/include/linux/mm_page_address.h
@@ -2,6 +2,15 @@
#ifndef _LINUX_MM_PAGE_ADDRESS
#define _LINUX_MM_PAGE_ADDRESS
+/*
+ * CONFIG_SPARSEMEM's definitions have a couple of layering violations,
+ * such as the reliance on __pfn_to_section() or page_to_section(),
+ * which are defined in a high-level header (linux/mmzone_api.h):
+ */
+#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
+# include <linux/mmzone_api.h>
+#endif
+
#include <linux/mm_types.h>
#include <asm/page.h>
diff --git a/include/linux/pgtable_api.h b/include/linux/pgtable_api.h
index 7b790219142aa..191bb582d9beb 100644
--- a/include/linux/pgtable_api.h
+++ b/include/linux/pgtable_api.h
@@ -4,6 +4,17 @@
#include <linux/pgtable_types.h>
+/*
+ * CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP's definitions in <asm-generic/memory_model.h>
+ * have a couple of layering violations, such as the reliance on __pfn_to_section() or
+ * page_to_section(), * which are defined in a high-level header (linux/mmzone_api.h).
+ *
+ * Include the high level header as a quirk:
+ */
+#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
+# include <linux/mmzone_api.h>
+#endif
+
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/pgtable_api_access.h>
diff --git a/include/xen/page.h b/include/xen/page.h
index 285677b42943a..994690620d4c9 100644
--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -2,6 +2,17 @@
#ifndef _XEN_PAGE_H
#define _XEN_PAGE_H
+/*
+ * CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP's definitions in <asm-generic/memory_model.h>
+ * have a couple of layering violations, such as the reliance on __pfn_to_section() or
+ * page_to_section(), * which are defined in a high-level header (linux/mmzone_api.h).
+ *
+ * Include the high level header as a quirk:
+ */
+#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
+# include <linux/mmzone_api.h>
+#endif
+
#include <asm/page.h>
/* The hypercall interface supports only 4KB page */