mm: consolidate pgtable_cache_init() and pgd_cache_init()
Subsystems (25)
PATCH 1/1 mm: consolidate pgtable_cache_init() and pgd_cache_init()
Both pgtable_cache_init() and pgd_cache_init() are used to initialize kmem cache for page table allocations on several architectures that do not use PAGE_SIZE tables for one or more levels of the page table hierarchy.
Most architectures do not implement these functions and use __week default NOP implementation of pgd_cache_init(). Since there is no such default for pgtable_cache_init(), its empty stub is duplicated among most architectures.
Rename the definitions of pgd_cache_init() to pgtable_cache_init() and drop empty stubs of pgtable_cache_init().
--- arch/alpha/include/asm/pgtable.h | 1 - arch/arc/include/asm/pgtable.h | 1 - arch/arm/include/asm/pgtable-nommu.h | 1 - arch/arm/include/asm/pgtable.h | 1 - arch/arm64/include/asm/pgtable.h | 2 -- arch/arm64/mm/pgd.c | 2 +- arch/c6x/include/asm/pgtable.h | 1 - arch/csky/include/asm/pgtable.h | 1 - arch/h8300/include/asm/pgtable.h | 2 -- arch/hexagon/include/asm/pgtable.h | 1 - arch/hexagon/mm/Makefile | 2 +- arch/hexagon/mm/pgalloc.c | 10 ---------- arch/ia64/include/asm/pgtable.h | 1 - arch/m68k/include/asm/pgtable_mm.h | 1 - arch/m68k/include/asm/pgtable_no.h | 1 - arch/microblaze/include/asm/pgtable.h | 2 -- arch/mips/include/asm/pgtable.h | 1 - arch/nds32/include/asm/pgtable.h | 1 - arch/nios2/include/asm/pgtable.h | 1 - arch/openrisc/include/asm/pgtable.h | 1 - arch/parisc/include/asm/pgtable.h | 1 - arch/powerpc/include/asm/pgtable.h | 1 - arch/riscv/include/asm/pgtable.h | 5 ----- arch/s390/include/asm/pgtable.h | 5 ----- arch/sh/include/asm/pgtable.h | 5 ----- arch/sh/mm/nommu.c | 4 ---- arch/sparc/include/asm/pgtable_32.h | 1 - arch/sparc/include/asm/pgtable_64.h | 1 - arch/um/include/asm/pgtable.h | 1 - arch/unicore32/include/asm/pgtable.h | 1 - arch/x86/include/asm/pgtable_32.h | 1 - arch/x86/include/asm/pgtable_64.h | 2 -- arch/x86/mm/pgtable.c | 6 +----- arch/xtensa/include/asm/pgtable.h | 1 - include/asm-generic/pgtable.h | 2 +- init/main.c | 3 +-- 36 files changed, 5 insertions(+), 69 deletions(-) delete mode 100644 arch/hexagon/mm/pgalloc.c
arch/alpha/include/asm/pgtable.h +0 -1
@@ -362,7 +362,6 @@ extern void paging_init(void);/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)/* We have our own get_unmapped_area to cope with ADDR_LIMIT_32BIT. */ #define HAVE_ARCH_UNMAPPED_AREA
arch/arc/include/asm/pgtable.h +0 -1
@@ -398,7 +398,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)#endif /* __ASSEMBLY__ */
arch/arm/include/asm/pgtable-nommu.h +0 -1
@@ -74,7 +74,6 @@ extern unsigned int kobjsize(const void *objp);/* * No page table caches to initialise. */ -#define pgtable_cache_init () do { } while (0)/* * All 32bit addresses are effectively valid for vmalloc...
arch/arm/include/asm/pgtable.h +0 -1
@@ -368,7 +368,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN -#define pgtable_cache_init () do { } while (0)#endif /* !__ASSEMBLY__ */
arch/arm64/include/asm/pgtable.h +0 -2
@@ -842,8 +842,6 @@ extern int kern_addr_valid(unsigned long addr);#include <asm-generic/pgtable.h> -static inline void pgtable_cache_init (void ) { } -/* * On AArch64, the cache coherency is handled via the set_pte_at() function. */
arch/arm64/mm/pgd.c +1 -1
@@ -35,7 +35,7 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd)kmem_cache_free (pgd_cache, pgd); } -void __init pgd_cache_init (void ) +void __init pgtable_cache_init (void ) {if (PGD_SIZE ==PAGE_SIZE )return ;
arch/c6x/include/asm/pgtable.h +0 -1
@@ -62,7 +62,6 @@ extern unsigned long empty_zero_page;/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)/* * c6x is !MMU, so define the simpliest implementation
arch/csky/include/asm/pgtable.h +0 -1
@@ -309,7 +309,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,/* * No page table caches to initialise */ -#define pgtable_cache_init () do {} while (0)#define io_remap_pfn_range (vma, vaddr, pfn, size, prot) \ remap_pfn_range(vma, vaddr, pfn, size, prot)
arch/h8300/include/asm/pgtable.h +0 -2
@@ -4,7 +4,6 @@#define __ARCH_USE_5LEVEL_HACK#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable.h> -#define pgtable_cache_init () do { } while (0)extern void paging_init (void );#define PAGE_NONE __pgprot(0)/* these mean nothing to NO_MM */ #define PAGE_SHARED __pgprot(0)/* these mean nothing to NO_MM */
@@ -37,7 +36,6 @@ extern int is_in_rom(unsigned long);/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)/* * All 32bit addresses are effectively valid for vmalloc...
arch/hexagon/include/asm/pgtable.h +0 -1
@@ -432,7 +432,6 @@ static inline int pte_exec(pte_t pte)#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))/* I think this is in case we have page table caches; needed by init/main.c */ -#define pgtable_cache_init () do { } while (0)/* * Swap/file PTE definitions. If _PAGE_PRESENT is zero, the rest of the PTE is
arch/hexagon/mm/Makefile +1 -1
@@ -3,5 +3,5 @@ # Makefile for Hexagon memory management subsystem # -obj-y := init.o pgalloc.o ioremap.o uaccess.o vm_fault.o cache.o +obj-y := init.o ioremap.o uaccess.o vm_fault.o cache.o obj-y += copy_to_user.o copy_from_user.o strnlen_user.o vm_tlb.o
arch/hexagon/mm/pgalloc.c deleted +0 -10
@@ -1,10 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. -*/ - -#include <linux/init.h> - -void __init pgtable_cache_init (void ) -{ -}
arch/ia64/include/asm/pgtable.h +0 -1
@@ -569,7 +569,6 @@ extern struct page *zero_page_memmap_ptr;/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)/* These tell get_user_pages() that the first gate page is accessible from user-level. */ #define FIXADDR_USER_START GATE_ADDR
arch/m68k/include/asm/pgtable_mm.h +0 -1
@@ -176,6 +176,5 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)#endif /* _M68K_PGTABLE_H */
arch/m68k/include/asm/pgtable_no.h +0 -1
@@ -47,7 +47,6 @@ extern void paging_init(void);/* * No page table caches to initialise. */ -#define pgtable_cache_init () do { } while (0)/* * All 32bit addresses are effectively valid for vmalloc...
arch/microblaze/include/asm/pgtable.h +0 -2
@@ -46,7 +46,6 @@ extern int mem_init_done;#define swapper_pg_dir ((pgd_t *) NULL) -#define pgtable_cache_init () do {} while (0)#define arch_enter_lazy_cpu_mode () do {} while (0)
@@ -529,7 +528,6 @@ extern unsigned long iopa(unsigned long addr);/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)void do_page_fault (struct pt_regs *regs,unsigned long address,unsigned long error_code);
arch/mips/include/asm/pgtable.h +0 -1
@@ -664,6 +664,5 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)#endif /* _ASM_PGTABLE_H */
arch/nds32/include/asm/pgtable.h +0 -1
@@ -403,7 +403,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];* into virtual address `from' */ -#define pgtable_cache_init () do { } while (0)#endif /* !__ASSEMBLY__ */
arch/nios2/include/asm/pgtable.h +0 -1
@@ -291,7 +291,6 @@ static inline void pte_clear(struct mm_struct *mm,#include <asm-generic/pgtable.h> -#define pgtable_cache_init () do { } while (0)extern void __init paging_init (void );extern void __init mmu_init (void );
arch/openrisc/include/asm/pgtable.h +0 -1
@@ -446,7 +446,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)typedef pte_t *pte_addr_t ;
arch/parisc/include/asm/pgtable.h +0 -1
@@ -133,7 +133,6 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)#define PTRS_PER_PTE (1UL << BITS_PER_PTE)/* Definitions for 2nd level */ -#define pgtable_cache_init () do { } while (0)#define PMD_SHIFT (PLD_SHIFT + BITS_PER_PTE)#define PMD_SIZE (1UL << PMD_SHIFT)
arch/powerpc/include/asm/pgtable.h +0 -1
@@ -97,7 +97,6 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);unsigned long vmalloc_to_phys (void *vmalloc_addr);void pgtable_cache_add (unsigned int shift); -void pgtable_cache_init (void );#if defined(CONFIG_STRICT_KERNEL_RWX ) || defined(CONFIG_PPC32 )void mark_initmem_nx (void );
arch/riscv/include/asm/pgtable.h +0 -5
@@ -411,11 +411,6 @@ extern void *dtb_early_va;extern void setup_bootmem (void );extern void paging_init (void ); -static inline void pgtable_cache_init (void ) -{ -/* No page table caches to initialize */ -} -#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)#define VMALLOC_END (PAGE_OFFSET - 1)#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
arch/s390/include/asm/pgtable.h +0 -5
@@ -1682,11 +1682,6 @@ extern void s390_reset_cmma(struct mm_struct *mm);#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN -/* -* No page table caches to initialise -*/ -static inline void pgtable_cache_init (void ) { } -#include <asm-generic/pgtable.h> #endif /* _S390_PAGE_H */
arch/sh/include/asm/pgtable.h +0 -5
@@ -123,11 +123,6 @@ typedef pte_t *pte_addr_t;#define pte_pfn (x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) -/* -* Initialise the page table caches -*/ -extern void pgtable_cache_init (void ); -struct vm_area_struct ;struct mm_struct ;
arch/sh/mm/nommu.c +0 -4
@@ -97,7 +97,3 @@ void __init page_table_range_init(unsigned long start, unsigned long end,void __set_fixmap (enum fixed_addresses idx,unsigned long phys,pgprot_t prot) { } - -void pgtable_cache_init (void ) -{ -}
arch/sparc/include/asm/pgtable_32.h +0 -1
@@ -448,6 +448,5 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)#endif /* !(_SPARC_PGTABLE_H) */
arch/sparc/include/asm/pgtable_64.h +0 -1
@@ -1135,7 +1135,6 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, unsigned long);#define HAVE_ARCH_FB_UNMAPPED_AREA -void pgtable_cache_init (void );void sun4v_register_fault_status (void );void sun4v_ktsb_register (void );void __init cheetah_ecache_flush_init (void );
arch/um/include/asm/pgtable.h +0 -1
@@ -32,7 +32,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];/* zero page used for uninitialized stuff */ extern unsigned long *empty_zero_page; -#define pgtable_cache_init () do ; while (0)/* Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the
arch/unicore32/include/asm/pgtable.h +0 -1
@@ -287,7 +287,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];#include <asm-generic/pgtable.h> -#define pgtable_cache_init () do { } while (0)#endif /* !__ASSEMBLY__ */
arch/x86/include/asm/pgtable_32.h +0 -1
@@ -29,7 +29,6 @@ extern pgd_t swapper_pg_dir[1024];extern pgd_t initial_page_table[1024 ];extern pmd_t initial_pg_pmd[]; -static inline void pgtable_cache_init (void ) { }void paging_init (void );void sync_initial_page_table (void );
arch/x86/include/asm/pgtable_64.h +0 -2
@@ -241,8 +241,6 @@ extern void cleanup_highmap(void);#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN -#define pgtable_cache_init () do { } while (0) -#define PAGE_AGP PAGE_KERNEL_NOCACHE#define HAVE_PAGE_AGP 1
arch/x86/mm/pgtable.c +1 -5
@@ -357,7 +357,7 @@ static void pgd_prepopulate_user_pmd(struct mm_struct *mm,static struct kmem_cache *pgd_cache; -void __init pgd_cache_init (void ) +void __init pgtable_cache_init (void ) {/* * When PAE kernel is running as a Xen domain, it does not use
@@ -402,10 +402,6 @@ static inline void _pgd_free(pgd_t *pgd) }#else -void __init pgd_cache_init (void ) -{ -} -static inline pgd_t *_pgd_alloc (void ) { return (pgd_t *)__get_free_pages(GFP_PGTABLE_USER,
arch/xtensa/include/asm/pgtable.h +0 -1
@@ -238,7 +238,6 @@ extern void paging_init(void);# define swapper_pg_dir NULLstatic inline void paging_init (void ) { }#endif -static inline void pgtable_cache_init (void ) { }/* * The pmd contains the kernel virtual address of the pte page.
include/asm-generic/pgtable.h +1 -1
@@ -1125,7 +1125,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,static inline void init_espfix_bsp (void ) { }#endif -extern void __init pgd_cache_init (void ); +extern void __init pgtable_cache_init (void );#ifndef __HAVE_ARCH_PFN_MODIFY_ALLOWEDstatic inline bool pfn_modify_allowed (unsigned long pfn,pgprot_t prot)
init/main.c +1 -2
@@ -507,7 +507,7 @@ void __init __weak mem_encrypt_init(void) { }void __init __weak poking_init (void ) { } -void __init __weak pgd_cache_init (void ) { } +void __init __weak pgtable_cache_init (void ) { }bool initcall_debug;core_param (initcall_debug, initcall_debug, bool,0644 );
@@ -565,7 +565,6 @@ static void __init mm_init(void)init_espfix_bsp ();/* Should be run after espfix64 is set up. */ pti_init (); -pgd_cache_init (); }void __init __weak arch_call_rest_init (void )
Signature · 1 line
2.7.4
arch/alpha/include/asm/pgtable.h extern void paging_init(void); · line 365
Quoted 6 lines · Mike Rapoport
+++
b/arch/alpha/include/asm/pgtable.harch/alpha/include/asm/pgtable.h +0
-1@@ -362,7 +362,6 @@ extern void paging_init(void);/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)
Delete the comment too?
arch/alpha/include/asm/pgtable.h void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, · line 401
Quoted 6 lines
arch/alpha/include/asm/pgtable.h +1
-1+++ b/arch/arc/include/asm/pgtable.h@@ -398,7 +398,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)
ditto
arch/arm/include/asm/pgtable.h static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) · line 372
Quoted 8 lines
arch/arm/include/asm/pgtable.h +1
-1+++ b/arch/arm/include/asm/pgtable.h@@ -368,7 +368,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN -#define pgtable_cache_init () do { } while (0)#endif /* !__ASSEMBLY__ */
delete one of the two blank lines?
arch/alpha/include/asm/pgtable.h extern unsigned long empty_zero_page; · line 65
Quoted 6 lines
arch/alpha/include/asm/pgtable.h +1
-1+++ b/arch/c6x/include/asm/pgtable.h@@ -62,7 +62,6 @@ extern unsigned long empty_zero_page;/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)
delete comment ... more of these.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 30 lines · Matthew Wilcox
arch/alpha/include/asm/pgtable.h extern void paging_init(void); · line 365
Quoted 6 lines · Mike Rapoport
+++
b/arch/alpha/include/asm/pgtable.harch/alpha/include/asm/pgtable.h +0
-1@@ -362,7 +362,6 @@ extern void paging_init(void);/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)Delete the comment too?
arch/alpha/include/asm/pgtable.h void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, · line 401
Quoted 6 lines
arch/alpha/include/asm/pgtable.h +1
-1+++ b/arch/arc/include/asm/pgtable.h@@ -398,7 +398,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)ditto
arch/arm/include/asm/pgtable.h static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) · line 372
Quoted 8 lines
arch/arm/include/asm/pgtable.h +1
-1+++ b/arch/arm/include/asm/pgtable.h@@ -368,7 +368,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN -#define pgtable_cache_init () do { } while (0)#endif /* !__ASSEMBLY__ */ delete one of the two blank lines?
Quoted 8 lines
arch/alpha/include/asm/pgtable.h extern unsigned long empty_zero_page; · line 65
Quoted 6 lines
arch/alpha/include/asm/pgtable.h +1
-1+++ b/arch/c6x/include/asm/pgtable.h@@ -62,7 +62,6 @@ extern unsigned long empty_zero_page;/* * No page table caches to initialise */ -#define pgtable_cache_init () do { } while (0)delete comment ... more of these.
Actually, most of them :)
Thanks for spotting this.
Signature · 2 lines
Sincerely yours, Mike.
Will Deacon
maintainerQuoted 14 lines · Mike Rapoport
Both
pgtable_cache_init()andpgd_cache_init()are used to initialize kmem cache for page table allocations on several architectures that do not usePAGE_SIZEtables for one or more levels of the page table hierarchy.Most architectures do not implement these functions and use
__weekdefault NOP implementation ofpgd_cache_init(). Since there is no such default forpgtable_cache_init(), its empty stub is duplicated among most architectures.Rename the definitions of
pgd_cache_init()topgtable_cache_init()and drop empty stubs ofpgtable_cache_init().Signed-off-by Mike Rapoport <[email protected]>---
[...]
Quoted 13 lines
arch/arm64/mm/pgd.c +1
-1@@ -35,7 +35,7 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd)kmem_cache_free (pgd_cache, pgd); } -void __init pgd_cache_init (void ) +void __init pgtable_cache_init (void ) {if (PGD_SIZE ==PAGE_SIZE )return ;
[...]
Quoted 14 lines
init/main.c +1
-1@@ -507,7 +507,7 @@ void __init __weak mem_encrypt_init(void) { }void __init __weak poking_init (void ) { } -void __init __weak pgd_cache_init (void ) { } +void __init __weak pgtable_cache_init (void ) { }bool initcall_debug;core_param (initcall_debug, initcall_debug, bool,0644 );
init/main.c static void __init mm_init(void) · line 568
Quoted 5 lines
init/main.c +0
-1@@ -565,7 +565,6 @@ static void __init mm_init(void)init_espfix_bsp ();/* Should be run after espfix64 is set up. */ pti_init (); -pgd_cache_init (); }
AFAICT, this change means we now initialise our pgd cache before debug_objects_mem_init() has run. Is that going to cause fireworks with CONFIG_DEBUG_OBJECTS when we later free a pgd?
Will
Quoted 45 lines · Will Deacon
Quoted 14 lines · Mike Rapoport
Both
pgtable_cache_init()andpgd_cache_init()are used to initialize kmem cache for page table allocations on several architectures that do not usePAGE_SIZEtables for one or more levels of the page table hierarchy.Most architectures do not implement these functions and use
__weekdefault NOP implementation ofpgd_cache_init(). Since there is no such default forpgtable_cache_init(), its empty stub is duplicated among most architectures.Rename the definitions of
pgd_cache_init()topgtable_cache_init()and drop empty stubs ofpgtable_cache_init().Signed-off-by Mike Rapoport <[email protected]>---
[...]
Quoted 13 lines
arch/arm64/mm/pgd.c +1
-1@@ -35,7 +35,7 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd)kmem_cache_free (pgd_cache, pgd); } -void __init pgd_cache_init (void ) +void __init pgtable_cache_init (void ) {if (PGD_SIZE ==PAGE_SIZE )return ;[...]
Quoted 11 lines
init/main.c +1
-1@@ -507,7 +507,7 @@ void __init __weak mem_encrypt_init(void) { }void __init __weak poking_init (void ) { } -void __init __weak pgd_cache_init (void ) { } +void __init __weak pgtable_cache_init (void ) { }
Quoted 11 lines
init/main.c static void __init mm_init(void) · line 568
Quoted 8 lines
init/main.c +0
-1bool initcall_debug;core_param (initcall_debug, initcall_debug, bool,0644 );@@ -565,7 +565,6 @@ static void __init mm_init(void)init_espfix_bsp ();/* Should be run after espfix64 is set up. */ pti_init (); -pgd_cache_init (); }AFAICT, this change means we now initialise our pgd cache before
debug_objects_mem_init()has run.
Right.
Quoted 2 lines
Is that going to cause fireworks with
CONFIG_DEBUG_OBJECTSwhen we later free a pgd?
We don't allocate a pgd at that time, we only create the kmem cache for the future allocations. And that cache is never destroyed anyway.
Quoted 1 line
Will
Signature · 2 lines
Sincerely yours, Mike.
Quoted 5 lines · Mike Rapoport
Both
pgtable_cache_init()andpgd_cache_init()are used to initialize kmem cache for page table allocations on several architectures that do not usePAGE_SIZEtables for one or more levels of the page table hierarchy.Most architectures do not implement these functions and use
__weekdefault
s/week/weak ?
Quoted 25 lines · Mike Rapoport
Quoted 12 lines · Will Deacon
Quoted 11 lines · Mike Rapoport
init/main.c +1
-1@@ -507,7 +507,7 @@ void __init __weak mem_encrypt_init(void) { }void __init __weak poking_init (void ) { } -void __init __weak pgd_cache_init (void ) { } +void __init __weak pgtable_cache_init (void ) { }Quoted 11 lines
init/main.c static void __init mm_init(void) · line 568
Quoted 8 lines
init/main.c +0
-1bool initcall_debug;core_param (initcall_debug, initcall_debug, bool,0644 );@@ -565,7 +565,6 @@ static void __init mm_init(void)init_espfix_bsp ();/* Should be run after espfix64 is set up. */ pti_init (); -pgd_cache_init (); }AFAICT, this change means we now initialise our pgd cache before
debug_objects_mem_init()has run.
Quoted 7 lines
Right.
Quoted 2 lines
Is that going to cause fireworks with
CONFIG_DEBUG_OBJECTSwhen we later free a pgd?We don't allocate a pgd at that time, we only create the kmem cache for the future allocations. And that cache is never destroyed anyway.
Thanks for the explanation. In which case, for arm64:
Will
Quoted 39 lines · Mike Rapoport
arch/x86/include/asm/pgtable_32.h +0
-1@@ -29,7 +29,6 @@ extern pgd_t swapper_pg_dir[1024];extern pgd_t initial_page_table[1024 ];extern pmd_t initial_pg_pmd[]; -static inline void pgtable_cache_init (void ) { }void paging_init (void );void sync_initial_page_table (void );arch/x86/include/asm/pgtable_64.h +0
-2@@ -241,8 +241,6 @@ extern void cleanup_highmap(void);#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN -#define pgtable_cache_init () do { } while (0) -#define PAGE_AGP PAGE_KERNEL_NOCACHE#define HAVE_PAGE_AGP 1arch/x86/mm/pgtable.c +1
-1@@ -357,7 +357,7 @@ static void pgd_prepopulate_user_pmd(struct mm_struct *mm,static struct kmem_cache *pgd_cache; -void __init pgd_cache_init (void ) +void __init pgtable_cache_init (void ) {/* * When PAE kernel is running as a Xen domain, it does not use
arch/x86/mm/pgtable.c static inline void _pgd_free(pgd_t *pgd) · line 407
Quoted 6 lines
arch/x86/mm/pgtable.c +0
-3@@ -402,10 +402,6 @@ static inline void _pgd_free(pgd_t *pgd) }#else -void __init pgd_cache_init (void ) -{ -}
Quoted 9 lines · Marc Gonzalez
Quoted 5 lines · Mike Rapoport
Both
pgtable_cache_init()andpgd_cache_init()are used to initialize kmem cache for page table allocations on several architectures that do not usePAGE_SIZEtables for one or more levels of the page table hierarchy.Most architectures do not implement these functions and use
__weekdefaults/week/weak ?
Sure, thanks!
Signature · 2 lines
Sincerely yours, Mike.