[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201217130758.11565-5-osalvador@suse.de>
Date: Thu, 17 Dec 2020 14:07:57 +0100
From: Oscar Salvador <osalvador@...e.de>
To: akpm@...ux-foundation.org
Cc: david@...hat.com, mhocko@...nel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, vbabka@...e.cz, pasha.tatashin@...een.com,
Oscar Salvador <osalvador@...e.de>
Subject: [PATCH 4/5] powerpc/memhotplug: Enable MHP_MEMMAP_ON_MEMORY when supported
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@...e.de>
---
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;
--
2.26.2
Powered by blists - more mailing lists