Skip to contentSkip to conversation

+ mm-nobootmem-free_all_bootmem-again.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Jan 14, 2014

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-nobootmem-free_all_bootmem-again.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 13 Jan 2014 16:34:24 -0800

The patch titled
Subject: mm/nobootmem: free_all_bootmem again
has been added to the -mm tree. Its filename is
mm-nobootmem-free_all_bootmem-again.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-nobootmem-free_all_bootmem-again.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-nobootmem-free_all_bootmem-again.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Philipp Hachtmann <[email protected]>
Subject: mm/nobootmem: free_all_bootmem again

get_allocated_memblock_reserved_regions_info() should work if it is compiled in. Extended the ifdef around get_allocated_memblock_memory_regions_info() to include get_allocated_memblock_reserved_regions_info() as well. Similar changes in nobootmem.c/free_low_memory_core_early() where the two functions are called.

Cc qiuxishi <[email protected]>
Cc David Howells <[email protected]>
Cc Daeseok Youn <[email protected]>
Cc Jiang Liu <[email protected]>
Cc Yinghai Lu <[email protected]>
Cc Zhang Yanfei <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc Grygorii Strashko <[email protected]>
Cc Tang Chen <[email protected]>
Cc Martin Schwidefsky <[email protected]>

---

 mm/memblock.c  |   17 ++---------------
 mm/nobootmem.c |    4 ++--
 2 files changed, 4 insertions(+), 17 deletions(-)
mm/memblock.c renamed from mm/memblock.c~mm-nobootmem-free_all_bootmem-again +2 -15
diff -puN mm/memblock.c~mm-nobootmem-free_all_bootmem-again mm/memblock.c
@@ -266,33 +266,20 @@ static void __init_memblock memblock_rem
 	}
 }
 
+#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
+
 phys_addr_t __init_memblock get_allocated_memblock_reserved_regions_info(
 					phys_addr_t *addr)
 {
 	if (memblock.reserved.regions == memblock_reserved_init_regions)
 		return 0;
 
-	/*
-	 * Don't allow nobootmem allocator to free reserved memory regions
-	 * array if
-	 *  - CONFIG_DEBUG_FS is enabled;
-	 *  - CONFIG_ARCH_DISCARD_MEMBLOCK is not enabled;
-	 *  - reserved memory regions array have been resized during boot.
-	 * Otherwise debug_fs entry "sys/kernel/debug/memblock/reserved"
-	 * will show garbage instead of state of memory reservations.
-	 */
-	if (IS_ENABLED(CONFIG_DEBUG_FS) &&
-	    !IS_ENABLED(CONFIG_ARCH_DISCARD_MEMBLOCK))
-		return 0;
-
 	*addr = __pa(memblock.reserved.regions);
 
 	return PAGE_ALIGN(sizeof(struct memblock_region) *
 			  memblock.reserved.max);
 }
 
-#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
-
 phys_addr_t __init_memblock get_allocated_memblock_memory_regions_info(
 					phys_addr_t *addr)
 {
mm/nobootmem.c renamed from mm/nobootmem.c~mm-nobootmem-free_all_bootmem-again +2 -1
diff -puN mm/nobootmem.c~mm-nobootmem-free_all_bootmem-again mm/nobootmem.c
@@ -122,13 +122,13 @@ static unsigned long __init free_low_mem
 	for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL)
 		count += __free_memory_core(start, end);
 
+#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
+
 	/* Free memblock.reserved array if it was allocated */
 	size = get_allocated_memblock_reserved_regions_info(&start);
 	if (size)
 		count += __free_memory_core(start, start + size);
 
-#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK