Skip to contentSkip to conversation

unicore32: switch to NO_BOOTMEM

PATCH In review Mike Rapoport 2 participants 2 messages Jul 16, 2018 – Jul 22, 2018 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unicore32: switch to NO_BOOTMEM

The unicore32 already supports memblock and uses it for some early memory reservations, e.g initrd and the page tables.

At some point unicore32 allocates the bootmem bitmap from the memblock and then hands over the memory reservations from memblock to bootmem.

This patch removes the bootmem initialization and leaves memblock as the only boot time memory manager for unicore32.

---

I couldn't get unicore32 toolchain as the only link I was able to find [1] gives me timeout, so the best I could do to check the changes was

gcc <lots of flags> -c arch/unicore32/mm/init.c

[1] http://mprc.pku.edu.cn/~guanxuetao/linux/uc4-1.0.5-hard.tgz

 arch/unicore32/Kconfig   |  1 +
 arch/unicore32/mm/init.c | 54 +-----------------------------------------------
 2 files changed, 2 insertions(+), 53 deletions(-)
arch/unicore32/Kconfig +1 -0
index 03f991e..cff4b9d 100644
@@ -5,6 +5,7 @@ config UNICORE32
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_SERIO
 	select HAVE_MEMBLOCK
+	select NO_BOOTMEM
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_BZIP2
arch/unicore32/mm/init.c +1 -53

66 lines not on this page · raw message

Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Messages-----
From: "Mike Rapoport" <[email protected]>
Sent Time: 2018-07-16 16:00:24 (Monday)
To: "Guan Xuetao" <[email protected]>
Cc: "Michal Hocko" <[email protected]>, "Arnd Bergmann" <[email protected]>, [email protected], [email protected], "Mike Rapoport" <[email protected]>
Subject: [PATCH] unicore32: switch to NO_BOOTMEM

The unicore32 already supports memblock and uses it for some early memory reservations, e.g initrd and the page tables.

Quoted 7 lines

At some point unicore32 allocates the bootmem bitmap from the memblock and then hands over the memory reservations from memblock to bootmem.

This patch removes the bootmem initialization and leaves memblock as the only boot time memory manager for unicore32.

Seems ok to unicore32. Thanks.

Quoted 99 lines

---

I couldn't get unicore32 toolchain as the only link I was able to find [1] gives me timeout, so the best I could do to check the changes was

gcc <lots of flags> -c arch/unicore32/mm/init.c

[1] http://mprc.pku.edu.cn/~guanxuetao/linux/uc4-1.0.5-hard.tgz

 arch/unicore32/Kconfig   |  1 +
 arch/unicore32/mm/init.c | 54 +-----------------------------------------------
 2 files changed, 2 insertions(+), 53 deletions(-)
arch/unicore32/Kconfig +1 -0
index 03f991e..cff4b9d 100644
@@ -5,6 +5,7 @@ config UNICORE32
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_SERIO
 	select HAVE_MEMBLOCK
+	select NO_BOOTMEM
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_BZIP2
arch/unicore32/mm/init.c +1 -53
index f4950fb..44ccc15 100644
@@ -84,58 +84,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low,
 	}
 }
 
-static void __init uc32_bootmem_init(unsigned long start_pfn,
-	unsigned long end_pfn)
-{
-	struct memblock_region *reg;
-	unsigned int boot_pages;
-	phys_addr_t bitmap;
-	pg_data_t *pgdat;
-
-	/*
-	 * Allocate the bootmem bitmap page.  This must be in a region
-	 * of memory which has already been mapped.
-	 */
-	boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
-	bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
-				__pfn_to_phys(end_pfn));
-
-	/*
-	 * Initialise the bootmem allocator, handing the
-	 * memory banks over to bootmem.
-	 */
-	node_set_online(0);
-	pgdat = NODE_DATA(0);
-	init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
-
-	/* Free the lowmem regions from memblock into bootmem. */
-	for_each_memblock(memory, reg) {
-		unsigned long start = memblock_region_memory_base_pfn(reg);
-		unsigned long end = memblock_region_memory_end_pfn(reg);
-
-		if (end >= end_pfn)
-			end = end_pfn;
-		if (start >= end)
-			break;
-
-		free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
-	}
-
-	/* Reserve the lowmem memblock reserved regions in bootmem. */
-	for_each_memblock(reserved, reg) {
-		unsigned long start = memblock_region_reserved_base_pfn(reg);
-		unsigned long end = memblock_region_reserved_end_pfn(reg);
-
-		if (end >= end_pfn)
-			end = end_pfn;
-		if (start >= end)
-			break;
-
-		reserve_bootmem(__pfn_to_phys(start),
-			(end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
-	}
-}
-
 static void __init uc32_bootmem_free(unsigned long min, unsigned long max_low,
 	unsigned long max_high)
 {
@@ -232,7 +180,7 @@ void __init bootmem_init(void)
 
 	find_limits(&min, &max_low, &max_high);
 
-	uc32_bootmem_init(min, max_low);
+	node_set_online(0);
 
 #ifdef CONFIG_SWIOTLB
 	swiotlb_init(1);
Signature · 1 line
2.7.4