Re: [PATCH v4 2/2] RISC-V: Implement sparsemem

From: Logan Gunthorpe
Date: Tue Aug 13 2019 - 12:15:02 EST




On 2019-08-13 12:04 a.m., Greentime Hu wrote:
> I think flat mem doesn't support memory-with-hole scenario.
> In mm/Kconfig, it says
> "
> For systems that have holes in their physical address
> spaces and for features like NUMA and memory hotplug,
> choose "Sparse Memory"
> "
> IMHO, the memory-with-hole scenario should only be tested for sparse
> mem but flat mem.

Fair enough.

> The generic pfn_valid() is just for non-mmu arches.

The generic pfn_valid() in asm-generic is only for non-mmu arches.

> Every architecture
> with mmu defines their own pfn_valid().

Not true. Arm64, for example just uses the generic implementation in
mmzone.h. My main question is whether we can just do that. If we can't
we should probably structure it like powerpc where they only use the
arch-specific helper for CONFIG_FLATMEM instead of when CONFIG_SPARSEMEM
isn't set.

Logan