All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vmemmap, memory_hotplug: fallback to base pages for vmmap
@ 2017-07-11 13:42 ` Michal Hocko
  0 siblings, 0 replies; 14+ messages in thread
From: Michal Hocko @ 2017-07-11 13:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Cristopher Lameter, Johannes Weiner, Vlastimil Babka, linux-mm,
	LKML, Michal Hocko

From: Michal Hocko <mhocko@suse.com>

vmemmap_populate uses huge pages if the CPU supports them which is good
and usually what we want. vmemmap_alloc_block will use the bootmem
allocator in the early initialization so the allocation will most likely
succeed. This is not the case for the memory hotplug though. Such an
allocation can easily fail under memory pressure. Especially so when the
kernel memory is restricted with movable_node parameter.

There is no real reason to fail the vmemmap_populate when
vmemmap_populate_hugepages fails though. We can still fallback to
vmemmap_populate_basepages and use base pages. The performance will not
be optimal but this is much better than failing the memory hot add.

Signed-off-by: Michal Hocko <mhocko@suse.com>
---
 arch/x86/mm/init_64.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 136422d7d539..e6e3c755b9cb 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1401,15 +1401,16 @@ static int __meminit vmemmap_populate_hugepages(unsigned long start,
 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
 {
 	struct vmem_altmap *altmap = to_vmem_altmap(start);
-	int err;
+	int err = -ENOMEM;
 
 	if (boot_cpu_has(X86_FEATURE_PSE))
 		err = vmemmap_populate_hugepages(start, end, node, altmap);
 	else if (altmap) {
 		pr_err_once("%s: no cpu support for altmap allocations\n",
 				__func__);
-		err = -ENOMEM;
-	} else
+		return err;
+	}
+	if (err)
 		err = vmemmap_populate_basepages(start, end, node);
 	if (!err)
 		sync_global_pgds(start, end - 1);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-07-12  9:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-11 13:42 [PATCH] vmemmap, memory_hotplug: fallback to base pages for vmmap Michal Hocko
2017-07-11 13:42 ` Michal Hocko
2017-07-11 14:25 ` Michal Hocko
2017-07-11 14:25   ` Michal Hocko
2017-07-11 17:26   ` Johannes Weiner
2017-07-11 17:26     ` Johannes Weiner
2017-07-11 18:06     ` Christoph Lameter
2017-07-11 18:06       ` Christoph Lameter
2017-07-11 21:25     ` Michal Hocko
2017-07-11 21:25       ` Michal Hocko
2017-07-11 21:45       ` Johannes Weiner
2017-07-11 21:45         ` Johannes Weiner
2017-07-12  9:03         ` Michal Hocko
2017-07-12  9:03           ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.