riscv: Cleanup setup_bootmem()
PATCH 1/1 riscv: Cleanup setup_bootmem()
After the following patches,
commit de043da0b9e7 ("RISC-V: Fix usage of memblock_enforce_memory_limit") commit 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area") commit b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()")
some logical is useless, kill the mem_start/start/end and unneed code.
--- arch/riscv/mm/init.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
arch/riscv/mm/init.c +2 -19
@@ -108,34 +108,17 @@ void __init mem_init(void)void __init setup_bootmem (void ) { -phys_addr_t mem_start =0 ; -phys_addr_t start, dram_end, end =0 ;phys_addr_t vmlinux_end =__pa_symbol (&_end);phys_addr_t vmlinux_start =__pa_symbol (&_start); +phys_addr_t dram_end =memblock_end_of_DRAM ();phys_addr_t max_mapped_addr =__pa (~(ulong )0 ); -u64 i; - -/* Find the memory region containing the kernel */ -for_each_mem_range (i, &start, &end) { -phys_addr_t size = end - start; -if (!mem_start) - mem_start = start; -if (start <= vmlinux_start && vmlinux_end <= end) -BUG_ON (size ==0 ); - } -/* -* The maximal physical memory size is -PAGE_OFFSET. -* Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed -* as it is unusable by kernel. -*/ +/* The maximal physical memory size is -PAGE_OFFSET. */ memblock_enforce_memory_limit (-PAGE_OFFSET );/* Reserve from the start of the kernel to the end of the kernel */ memblock_reserve (vmlinux_start, vmlinux_end - vmlinux_start); - dram_end =memblock_end_of_DRAM (); -/* * memblock allocator is not aware of the fact that last 4K bytes of * the addressable memory can not be mapped because of IS_ERR_VALUE
Signature · 7 lines
2.26.2 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 9 lines · Kefeng Wang
After the following patches,
commit
de043da0b9e7("RISC-V: Fix usage ofmemblock_enforce_memory_limit") commit1bd14a66ee52("RISC-V: Remove any memblock representing unusable memory area") commitb10d6bca8720("arch, drivers: replacefor_each_membock()withfor_each_mem_range()")some logical is useless, kill the mem_start/start/end and unneed code.
/s/logical/logic
/s/unneed/uneeded
Quoted 50 lines
Signed-off-by Kefeng Wang <[email protected]>--- arch/riscv/mm/init.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)arch/riscv/mm/init.c +2
-20@@ -108,34 +108,17 @@ void __init mem_init(void)void __init setup_bootmem (void ) { -phys_addr_t mem_start =0 ; -phys_addr_t start, dram_end, end =0 ;phys_addr_t vmlinux_end =__pa_symbol (&_end);phys_addr_t vmlinux_start =__pa_symbol (&_start); +phys_addr_t dram_end =memblock_end_of_DRAM ();phys_addr_t max_mapped_addr =__pa (~(ulong )0 ); -u64 i; - -/* Find the memory region containing the kernel */ -for_each_mem_range (i, &start, &end) { -phys_addr_t size = end - start; -if (!mem_start) - mem_start = start; -if (start <= vmlinux_start && vmlinux_end <= end) -BUG_ON (size ==0 ); - } -/* -* The maximal physical memory size is -PAGE_OFFSET. -* Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed -* as it is unusable by kernel. -*/ +/* The maximal physical memory size is -PAGE_OFFSET. */ memblock_enforce_memory_limit (-PAGE_OFFSET );/* Reserve from the start of the kernel to the end of the kernel */ memblock_reserve (vmlinux_start, vmlinux_end - vmlinux_start); - dram_end =memblock_end_of_DRAM (); -/* * memblock allocator is not aware of the fact that last 4K bytes of * the addressable memory can not be mapped because of IS_ERR_VALUE -- 2.26.2
Quoted 4 lines
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Thanks for the fix. Other than the nits,
Signature · 7 lines
Regards, Atish _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 11 lines · Atish Patra
Quoted 8 lines · Kefeng Wang
After the following patches,
commit
de043da0b9e7("RISC-V: Fix usage ofmemblock_enforce_memory_limit") commit1bd14a66ee52("RISC-V: Remove any memblock representing unusable memory area") commitb10d6bca8720("arch, drivers: replacefor_each_membock()withfor_each_mem_range()")some logical is useless, kill the mem_start/start/end and unneed code.
/s/logical/logic
/s/unneed/uneeded
oops, will update and send new one, thanks.
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv