Skip to content

Commit 377f080

Browse files
Eugeniy Paltsevgregkh
authored andcommitted
ARC: adjust memblock_reserve of kernel memory
commit a3010a0465383300f909f62b8a83f83ffa7b2517 upstream. In setup_arch_memory we reserve the memory area wherein the kernel is located. Current implementation may reserve more memory than it actually required in case of CONFIG_LINUX_LINK_BASE is not equal to CONFIG_LINUX_RAM_BASE. This happens because we calculate start of the reserved region relatively to the CONFIG_LINUX_RAM_BASE and end of the region relatively to the CONFIG_LINUX_RAM_BASE. For example in case of HSDK board we wasted 256MiB of physical memory: ------------------->8------------------------------ Memory: 770416K/1048576K available (5496K kernel code, 240K rwdata, 1064K rodata, 2200K init, 275K bss, 278160K reserved, 0K cma-reserved) ------------------->8------------------------------ Fix that. Fixes: 9ed6878 ("ARC: mm: Decouple RAM base address from kernel link addr") Cc: stable@vger.kernel.org OnePlusOSS#4.14+ Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 95907c6 commit 377f080

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/arc/mm/init.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ void __init setup_arch_memory(void)
138138
*/
139139

140140
memblock_add_node(low_mem_start, low_mem_sz, 0);
141-
memblock_reserve(low_mem_start, __pa(_end) - low_mem_start);
141+
memblock_reserve(CONFIG_LINUX_LINK_BASE,
142+
__pa(_end) - CONFIG_LINUX_LINK_BASE);
142143

143144
#ifdef CONFIG_BLK_DEV_INITRD
144145
if (initrd_start)

0 commit comments

Comments
 (0)