Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544284 > unrolled thread

[PATCH 16/21] MIPS memblock: Alter paging initialization method

Started bySerge Semin <fancer.lancer@gmail.com>
First post2016-12-19 03:20 +0100
Last post2016-12-19 03:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 16/21] MIPS memblock: Alter paging initialization method Serge Semin <fancer.lancer@gmail.com> - 2016-12-19 03:20 +0100

#1544284 — [PATCH 16/21] MIPS memblock: Alter paging initialization method

FromSerge Semin <fancer.lancer@gmail.com>
Date2016-12-19 03:20 +0100
Subject[PATCH 16/21] MIPS memblock: Alter paging initialization method
Message-ID<sPVIu-1Cr-15@gated-at.bofh.it>
Apart from the actions it did before, it initializes sparsemem
if one activated. Memory zones size calculation is moved into an
individual method.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
---
 arch/mips/mm/init.c | 79 +++++++++++++++++++++++++----------
 1 file changed, 56 insertions(+), 23 deletions(-)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 49db909..6f186c7 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -58,6 +58,53 @@ EXPORT_SYMBOL_GPL(empty_zero_page);
 EXPORT_SYMBOL(zero_page_mask);
 
 /*
+ * Initialize sparse memory sections setting node ids and indexes
+ */
+static void __init mips_memory_present(void)
+{
+#ifdef CONFIG_SPARSEMEM
+	struct memblock_region *reg;
+
+	for_each_memblock(memory, reg)
+		memory_present(0, memblock_region_memory_base_pfn(reg),
+			memblock_region_memory_end_pfn(reg));
+#endif /* CONFIG_SPARSEMEM */
+}
+
+/*
+ * Setup nodes zone areas
+ */
+static void __init zone_sizes_init(void)
+{
+	unsigned long max_zone_pfns[MAX_NR_ZONES];
+
+	/* Clean zone boundaries array */
+	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+
+	/* Setup determined boundaries */
+#ifdef CONFIG_ZONE_DMA
+	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+#endif
+#ifdef CONFIG_ZONE_DMA32
+	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
+#endif
+	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
+#ifdef CONFIG_HIGHMEM
+	max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
+
+	/* Make sure the processor supports highmem */
+	if (cpu_has_dc_aliases && max_low_pfn != highend_pfn) {
+		pr_warn("CPU doesn't support highmem. %ldk highmem ignored\n",
+			(highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10));
+		max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn;
+	}
+#endif
+
+	/* Finally initialize nodes and page maps using memblock info */
+	free_area_init_nodes(max_zone_pfns);
+}
+
+/*
  * Not static inline because used by IP27 special magic initialization code
  */
 void setup_zero_pages(void)
@@ -386,36 +433,22 @@ int page_is_ram(unsigned long pagenr)
 
 void __init paging_init(void)
 {
-	unsigned long max_zone_pfns[MAX_NR_ZONES];
-	unsigned long lastpfn __maybe_unused;
-
+	/* Initialize page tables */
 	pagetable_init();
 
+	/* Initialize highmem mapping */
 #ifdef CONFIG_HIGHMEM
 	kmap_init();
 #endif
-#ifdef CONFIG_ZONE_DMA
-	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
-#endif
-#ifdef CONFIG_ZONE_DMA32
-	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
-#endif
-	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
-	lastpfn = max_low_pfn;
-#ifdef CONFIG_HIGHMEM
-	max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
-	lastpfn = highend_pfn;
 
-	if (cpu_has_dc_aliases && max_low_pfn != highend_pfn) {
-		printk(KERN_WARNING "This processor doesn't support highmem."
-		       " %ldk highmem ignored\n",
-		       (highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10));
-		max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn;
-		lastpfn = max_low_pfn;
-	}
-#endif
+	/* Mark present RAM memory */
+	mips_memory_present();
 
-	free_area_init_nodes(max_zone_pfns);
+	/* Initialize memory maps within sparse memory sections */
+	sparse_init();
+
+	/* Initialize free areas of nodes */
+	zone_sizes_init();
 }
 
 #ifdef CONFIG_64BIT
-- 
2.6.6

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web