Re: [PATCH] MIPS: Add set_memory_node()

Maciej W. Rozycki
2020-10-13T20:16:16Z

On Tue, 13 Oct 2020, Jinyang He wrote:

> Commit e7ae8d174eec ("MIPS: replace add_memory_region with memblock")
> replaced add_memory_region(, , BOOT_MEM_RAM) with memblock_add(). But
> it doesn't work well on some platforms which have NUMA like Loongson64.

Please note this is not a full review, I haven't investigated the fitness
for purpose of this change and instead just addressed one aspect of coding
style.

> diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
> index aa03b12..29e2d9c 100644
> --- a/arch/mips/include/asm/bootinfo.h
> +++ b/arch/mips/include/asm/bootinfo.h
> @@ -92,6 +92,10 @@ extern unsigned long mips_machtype;
>
> extern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_addr_t sz_max);
>
> +#ifdef CONFIG_NUMA
> +extern void set_memory_node(phys_addr_t start, phys_addr_t size);
> +#endif
> +

If anything this needs to be:

#ifdef CONFIG_NUMA
extern void set_memory_node(phys_addr_t start, phys_addr_t size);
#else
static inline void set_memory_node(phys_addr_t start, phys_addr_t size) {}
#endif

so as to avoid #ifdef clutter across call places.

Maciej