Re: [PATCH 4/5] powerpc/memhotplug: Enable MHP_MEMMAP_ON_MEMORY when supported

From: David Hildenbrand
Date: Mon Jan 11 2021 - 11:57:27 EST


On 17.12.20 14:07, Oscar Salvador wrote:
> Let the caller check whether it can pass MHP_MEMMAP_ON_MEMORY by
> checking mhp_supports_memmap_on_memory().
> MHP_MEMMAP_ON_MEMORY can only be set in case
> ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE is enabled, the architecture supports
> altmap, and the range to be added spans a single memory block.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> ---
> arch/powerpc/platforms/pseries/hotplug-memory.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index 7efe6ec5d14a..a7f68e282ec1 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -610,6 +610,7 @@ static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index)
>
> static int dlpar_add_lmb(struct drmem_lmb *lmb)
> {
> + mhp_t mhp_flags = MHP_NONE;
> unsigned long block_sz;
> int nid, rc;
>
> @@ -629,8 +630,10 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
> if (nid < 0 || !node_possible(nid))
> nid = first_online_node;
>
> + if (mhp_supports_memmap_on_memory(block_sz))
> + mhp_flags |= MHP_MEMMAP_ON_MEMORY;
> /* Add the memory */
> - rc = __add_memory(nid, lmb->base_addr, block_sz, MHP_NONE);
> + rc = __add_memory(nid, lmb->base_addr, block_sz, mhp_flags);
> if (rc) {
> invalidate_lmb_associativity_index(lmb);
> return rc;

With 16MB LMBs it's quite wasteful - you won't even have a huge page
fitting the the remaining part.

I do wonder if we want this on powerpc only with a bigger LMB/memory
block size (e.g., 256 MB, which is AFAIK the maximum usually found).

--
Thanks,

David / dhildenb