Re: [PATCH v2 13/15] MIPS: memblock: Discard bootmem from Loongson3 code

From: Matt Redfearn
Date: Tue Feb 13 2018 - 09:18:25 EST


Hi Serge,

On 02/02/18 03:54, Serge Semin wrote:
Loongson64/3 runs its own code to initialize memory allocator in
case of NUMA configuration is selected. So in order to move to the
pure memblock utilization we discard the bootmem allocator usage
and insert the memblock reservation method for kernel/addrspace_offset
memory regions.


I don't have a NUMA Loongson to test with, but on a non-NUMA Loongson3 machine, tested as a part of the whole series, this works and looks good to me.

Reviewed-by: Matt Redfearn <matt.redfearn@xxxxxxxx>

Thanks,
Matt


Signed-off-by: Serge Semin <fancer.lancer@xxxxxxxxx>
---
arch/mips/loongson64/loongson-3/numa.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c
index f17ef520799a..2f1ebf496c17 100644
--- a/arch/mips/loongson64/loongson-3/numa.c
+++ b/arch/mips/loongson64/loongson-3/numa.c
@@ -180,7 +180,6 @@ static void __init szmem(unsigned int node)
static void __init node_mem_init(unsigned int node)
{
- unsigned long bootmap_size;
unsigned long node_addrspace_offset;
unsigned long start_pfn, end_pfn, freepfn;
@@ -197,26 +196,21 @@ static void __init node_mem_init(unsigned int node)
__node_data[node] = prealloc__node_data + node;
- NODE_DATA(node)->bdata = &bootmem_node_data[node];
NODE_DATA(node)->node_start_pfn = start_pfn;
NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
- bootmap_size = init_bootmem_node(NODE_DATA(node), freepfn,
- start_pfn, end_pfn);
free_bootmem_with_active_regions(node, end_pfn);
if (node == 0) /* used by finalize_initrd() */
max_low_pfn = end_pfn;
- /* This is reserved for the kernel and bdata->node_bootmem_map */
- reserve_bootmem_node(NODE_DATA(node), start_pfn << PAGE_SHIFT,
- ((freepfn - start_pfn) << PAGE_SHIFT) + bootmap_size,
- BOOTMEM_DEFAULT);
+ /* This is reserved for the kernel only */
+ if (node == 0)
+ memblock_reserve(start_pfn << PAGE_SHIFT,
+ ((freepfn - start_pfn) << PAGE_SHIFT));
if (node == 0 && node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT)) {
/* Reserve 0xfe000000~0xffffffff for RS780E integrated GPU */
- reserve_bootmem_node(NODE_DATA(node),
- (node_addrspace_offset | 0xfe000000),
- 32 << 20, BOOTMEM_DEFAULT);
+ memblock_reserve(node_addrspace_offset | 0xfe000000, 32 << 20);
}
sparse_memory_present_with_active_regions(node);