diff options
| author | Kevin Brodsky <[email protected]> | 2025-04-08 09:52:17 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-05-12 00:48:22 +0000 |
| commit | 8240d8d3c5fb65fbdace7ae4db909b51f2253da7 (patch) | |
| tree | b0caf4ebe4e2ced2fe06bcecdb7b8175308c01d3 /rust/helpers/pid_namespace.c | |
| parent | sparc64: mm: call ctor/dtor for kernel PTEs (diff) | |
| download | kernel-8240d8d3c5fb65fbdace7ae4db909b51f2253da7.tar.gz kernel-8240d8d3c5fb65fbdace7ae4db909b51f2253da7.zip | |
mm: skip ptlock_init() for kernel PMDs
Split page table locks are not used for pgtables associated to init_mm, at
any level. pte_alloc_kernel() does not call ptlock_init() as a result.
There is however no separate alloc/free functions for kernel PMDs, and
pmd_ptlock_init() is called unconditionally. When ALLOC_SPLIT_PTLOCKS is
true (e.g. 32-bit architectures or if CONFIG_PREEMPT_RT is selected),
this results in unnecessary dynamic memory allocation every time a kernel
PMD is allocated.
Now that pagetable_pmd_ctor() is passed the associated mm, we can easily
remove this overhead by skipping pmd_ptlock_init() if the pgtable is
associated to init_mm. No special-casing is needed on the dtor path, as
ptlock_free() is already called unconditionally for all levels.
(ptlock_free() is a no-op unless a ptlock was allocated for the given
PTP.)
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kevin Brodsky <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Andreas Larsson <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Linus Waleij <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Qi Zheng <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: <[email protected]>
Cc: Yang Shi <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'rust/helpers/pid_namespace.c')
0 files changed, 0 insertions, 0 deletions
