Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/hugetlb: enforce that PMD PT sharing has split PMD PT locks

Sharing page tables between processes but falling back to per-MM page
table locks cannot possibly work.

So, let's make sure that we do have split PMD locks by adding a new
Kconfig option and letting that depend on CONFIG_SPLIT_PMD_PTLOCKS.

Link: https://lkml.kernel.org/r/20240726150728.3159964-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
188cac58 394290cb

+10 -7
+4
fs/Kconfig
··· 288 288 depends on ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP 289 289 depends on SPARSEMEM_VMEMMAP 290 290 291 + config HUGETLB_PMD_PAGE_TABLE_SHARING 292 + def_bool HUGETLB_PAGE 293 + depends on ARCH_WANT_HUGE_PMD_SHARE && SPLIT_PMD_PTLOCKS 294 + 291 295 config ARCH_HAS_GIGANTIC_PAGE 292 296 bool 293 297
+2 -3
include/linux/hugetlb.h
··· 1251 1251 } 1252 1252 #endif 1253 1253 1254 - #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 1254 + #ifdef CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING 1255 1255 static inline bool hugetlb_pmd_shared(pte_t *pte) 1256 1256 { 1257 1257 return page_count(virt_to_page(pte)) > 1; ··· 1287 1287 static inline pte_t * 1288 1288 hugetlb_walk(struct vm_area_struct *vma, unsigned long addr, unsigned long sz) 1289 1289 { 1290 - #if defined(CONFIG_HUGETLB_PAGE) && \ 1291 - defined(CONFIG_ARCH_WANT_HUGE_PMD_SHARE) && defined(CONFIG_LOCKDEP) 1290 + #if defined(CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING) && defined(CONFIG_LOCKDEP) 1292 1291 struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; 1293 1292 1294 1293 /*
+4 -4
mm/hugetlb.c
··· 7211 7211 return 0; 7212 7212 } 7213 7213 7214 - #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 7214 + #ifdef CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING 7215 7215 static unsigned long page_table_shareable(struct vm_area_struct *svma, 7216 7216 struct vm_area_struct *vma, 7217 7217 unsigned long addr, pgoff_t idx) ··· 7373 7373 return 1; 7374 7374 } 7375 7375 7376 - #else /* !CONFIG_ARCH_WANT_HUGE_PMD_SHARE */ 7376 + #else /* !CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING */ 7377 7377 7378 7378 pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma, 7379 7379 unsigned long addr, pud_t *pud) ··· 7396 7396 { 7397 7397 return false; 7398 7398 } 7399 - #endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */ 7399 + #endif /* CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING */ 7400 7400 7401 7401 #ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB 7402 7402 pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, ··· 7494 7494 /* See description above. Architectures can provide their own version. */ 7495 7495 __weak unsigned long hugetlb_mask_last_page(struct hstate *h) 7496 7496 { 7497 - #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 7497 + #ifdef CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING 7498 7498 if (huge_page_size(h) == PMD_SIZE) 7499 7499 return PUD_SIZE - PMD_SIZE; 7500 7500 #endif