]> git.baikalelectronics.ru Git - kernel.git/commitdiff
RISC-V: Set maximum number of mapped pages correctly
authorAtish Patra <atish.patra@wdc.com>
Wed, 15 Jul 2020 23:30:07 +0000 (16:30 -0700)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 25 Jul 2020 01:53:42 +0000 (18:53 -0700)
Currently, maximum number of mapper pages are set to the pfn calculated
from the memblock size of the memblock containing kernel. This will work
until that memblock spans the entire memory. However, it will be set to
a wrong value if there are multiple memblocks defined in kernel
(e.g. with efi runtime services).

Set the the maximum value to the pfn calculated from dram size.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/mm/init.c

index f4adb3684f3db8787530fef571a89e258539c957..8d22973bde40653ff7860a2ba1e06c3719671f70 100644 (file)
@@ -150,9 +150,9 @@ void __init setup_bootmem(void)
        /* Reserve from the start of the kernel to the end of the kernel */
        memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
 
-       set_max_mapnr(PFN_DOWN(mem_size));
        max_pfn = PFN_DOWN(memblock_end_of_DRAM());
        max_low_pfn = max_pfn;
+       set_max_mapnr(max_low_pfn);
 
 #ifdef CONFIG_BLK_DEV_INITRD
        setup_initrd();