[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250123172438.13BF4305@davehans-spike.ostc.intel.com>
Date: Thu, 23 Jan 2025 09:24:38 -0800
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: linux-kernel@...r.kernel.org
Cc: x86@...nel.org,tglx@...utronix.de,bp@...en8.de,joro@...tes.org,luto@...nel.org,peterz@...radead.org,kirill.shutemov@...ux.intel.com,rick.p.edgecombe@...el.com,jgross@...e.com,Dave Hansen <dave.hansen@...ux.intel.com>
Subject: [RFC][PATCH 6/8] x86/mm: Preallocate all PAE page tables
From: Dave Hansen <dave.hansen@...ux.intel.com>
Finally, move away from having PAE kernels share any PMDs across
processes.
This was already the default on PTI kernels which are the common
case.
Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
---
b/arch/x86/mm/pgtable.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff -puN arch/x86/mm/pgtable.c~simplify-PREALLOCATED_PMDS-3 arch/x86/mm/pgtable.c
--- a/arch/x86/mm/pgtable.c~simplify-PREALLOCATED_PMDS-3 2025-01-23 09:20:52.562415784 -0800
+++ b/arch/x86/mm/pgtable.c 2025-01-23 09:20:52.566415928 -0800
@@ -119,16 +119,11 @@ struct mm_struct *pgd_page_get_mm(struct
static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd)
{
- /* If the pgd points to a shared pagetable level (either the
- ptes in non-PAE, or shared PMD in PAE), then just copy the
- references from swapper_pg_dir. */
- if (CONFIG_PGTABLE_LEVELS == 2 ||
- (CONFIG_PGTABLE_LEVELS == 3 && SHARED_KERNEL_PMD) ||
- CONFIG_PGTABLE_LEVELS >= 4) {
+ /* PAE preallocates all its PMDs. No cloning needed. */
+ if (!IS_ENABLED(CONFIG_X86_PAE))
clone_pgd_range(pgd + KERNEL_PGD_BOUNDARY,
swapper_pg_dir + KERNEL_PGD_BOUNDARY,
KERNEL_PGD_PTRS);
- }
/* List used to sync kernel mapping updates */
pgd_set_mm(pgd, mm);
@@ -161,8 +156,7 @@ static void pgd_dtor(pgd_t *pgd)
* all 4 top-level entries are used almost immediately in a
* new process's life, we just pre-populate them here.
*/
-#define PREALLOCATED_PMDS (static_cpu_has(X86_FEATURE_PTI) ? \
- PTRS_PER_PGD : KERNEL_PGD_BOUNDARY)
+#define PREALLOCATED_PMDS PTRS_PER_PGD
#define MAX_PREALLOCATED_PMDS PTRS_PER_PGD
/*
_
Powered by blists - more mailing lists