diff mbox series

[RFC,09/12] x86: add support of NUMA replication for efi page tables

Message ID 20231228131056.602411-10-artem.kuzin@huawei.com (mailing list archive)
State New, archived
Headers show
Series x86 NUMA-aware kernel replication | expand

Commit Message

Artem Kuzin Dec. 28, 2023, 1:10 p.m. UTC
From: Artem Kuzin <artem.kuzin@huawei.com>

Co-developed-by: Nikita Panov <nikita.panov@huawei-partners.com>
Signed-off-by: Nikita Panov <nikita.panov@huawei-partners.com>
Co-developed-by: Alexander Grubnikov <alexander.grubnikov@huawei.com>
Signed-off-by: Alexander Grubnikov <alexander.grubnikov@huawei.com>
Signed-off-by: Artem Kuzin <artem.kuzin@huawei.com>
---
 arch/x86/platform/efi/efi_64.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 77f7ac3668cb..986d2dddef7a 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -35,6 +35,7 @@ 
 #include <linux/ucs2_string.h>
 #include <linux/cc_platform.h>
 #include <linux/sched/task.h>
+#include <linux/numa_replication.h>
 
 #include <asm/setup.h>
 #include <asm/page.h>
@@ -71,6 +72,9 @@  int __init efi_alloc_page_tables(void)
 	p4d_t *p4d;
 	pud_t *pud;
 	gfp_t gfp_mask;
+#ifdef CONFIG_KERNEL_REPLICATION
+	int nid;
+#endif
 
 	gfp_mask = GFP_KERNEL | __GFP_ZERO;
 	efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, PGD_ALLOCATION_ORDER);
@@ -86,7 +90,12 @@  int __init efi_alloc_page_tables(void)
 	if (!pud)
 		goto free_p4d;
 
+#ifdef CONFIG_KERNEL_REPLICATION
+	for_each_online_node(nid)
+		per_numa_pgd(&efi_mm, nid) = efi_pgd;
+#else
 	efi_mm.pgd = efi_pgd;
+#endif
 	mm_init_cpumask(&efi_mm);
 	init_new_context(NULL, &efi_mm);