aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorPhilipp Hachtmann <phacht@linux.vnet.ibm.com>2014-01-23 18:53:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 19:36:51 -0500
commit5e270e254885893f8c82ab9b91caa648af3690df (patch)
tree58b97739585bc97ba085a2b44fc256867c8a3f35 /mm
parent87379ec8c2b8ae0acd526b87d2240afca92a7505 (diff)
mm: free memblock.memory in free_all_bootmem
When calling free_all_bootmem() the free areas under memblock's control are released to the buddy allocator. Additionally the reserved list is freed if it was reallocated by memblock. The same should apply for the memory list. Signed-off-by: Philipp Hachtmann <phacht@linux.vnet.ibm.com> Reviewed-by: Tejun Heo <tj@kernel.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Tang Chen <tangchen@cn.fujitsu.com> Cc: Toshi Kani <toshi.kani@hp.com> Cc: Jianguo Wu <wujianguo@huawei.com> Cc: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memblock.c16
-rw-r--r--mm/nobootmem.c10
2 files changed, 25 insertions, 1 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 1c2ef2c7edab..64ed2439cf75 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -291,6 +291,22 @@ phys_addr_t __init_memblock get_allocated_memblock_reserved_regions_info(
291 memblock.reserved.max); 291 memblock.reserved.max);
292} 292}
293 293
294#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
295
296phys_addr_t __init_memblock get_allocated_memblock_memory_regions_info(
297 phys_addr_t *addr)
298{
299 if (memblock.memory.regions == memblock_memory_init_regions)
300 return 0;
301
302 *addr = __pa(memblock.memory.regions);
303
304 return PAGE_ALIGN(sizeof(struct memblock_region) *
305 memblock.memory.max);
306}
307
308#endif
309
294/** 310/**
295 * memblock_double_array - double the size of the memblock regions array 311 * memblock_double_array - double the size of the memblock regions array
296 * @type: memblock type of the regions array being doubled 312 * @type: memblock type of the regions array being doubled
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index bb1a70cc97a7..17c89023184f 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -122,11 +122,19 @@ static unsigned long __init free_low_memory_core_early(void)
122 for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL) 122 for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL)
123 count += __free_memory_core(start, end); 123 count += __free_memory_core(start, end);
124 124
125 /* free range that is used for reserved array if we allocate it */ 125 /* Free memblock.reserved array if it was allocated */
126 size = get_allocated_memblock_reserved_regions_info(&start); 126 size = get_allocated_memblock_reserved_regions_info(&start);
127 if (size) 127 if (size)
128 count += __free_memory_core(start, start + size); 128 count += __free_memory_core(start, start + size);
129 129
130#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
131
132 /* Free memblock.memory array if it was allocated */
133 size = get_allocated_memblock_memory_regions_info(&start);
134 if (size)
135 count += __free_memory_core(start, start + size);
136#endif
137
130 return count; 138 return count;
131} 139}
132 140