@@ -233,12 +233,17 @@ void handle_page_fault(struct pt_regs *regs)
* Fault-in kernel-space virtual memory on-demand.
* The 'reference' page table is init_mm.pgd.
*
+ * For memory hotplug enabled systems, the PGD entries are
+ * pre-allocated, which avoids the need to synchronize
+ * pgd/fault-in.
+ *
* NOTE! We MUST NOT take any locks for this case. We may
* be in an interrupt or a critical region, and should
* only copy the information from the master page table,
* nothing more.
*/
- if (unlikely((addr >= VMALLOC_START) && (addr < VMALLOC_END))) {
+ if (unlikely(!IS_ENABLED(CONFIG_MEMORY_HOTPLUG) &&
+ (addr >= VMALLOC_START) && (addr < VMALLOC_END))) {
vmalloc_fault(regs, code, addr);
return;
}
@@ -236,6 +236,7 @@ static void __init preallocate_pgd_pages_range(unsigned long start, unsigned lon
static void __init prepare_memory_hotplug(void)
{
#ifdef CONFIG_MEMORY_HOTPLUG
+ preallocate_pgd_pages_range(VMALLOC_START, VMALLOC_END, "vmalloc");
preallocate_pgd_pages_range(VMEMMAP_START, VMEMMAP_END, "vmemmap");
preallocate_pgd_pages_range(PAGE_OFFSET, PAGE_END, "direct map");
#endif