mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-22 07:53:11 -05:00
mm: define general function pXd_init()
pud_init(), pmd_init() and kernel_pte_init() are duplicated defined in file kasan.c and sparse-vmemmap.c as weak functions. Move them to generic header file pgtable.h, architecture can redefine them. Link: https://lkml.kernel.org/r/20241104070712.52902-1-maobibo@loongson.cn Signed-off-by: Bibo Mao <maobibo@loongson.cn> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@gmail.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com> Cc: WANG Xuerui <kernel@xen0n.name> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
7591c127f3
commit
7269ed4af3
6 changed files with 26 additions and 27 deletions
|
@ -268,8 +268,11 @@ extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pm
|
|||
*/
|
||||
extern void pgd_init(void *addr);
|
||||
extern void pud_init(void *addr);
|
||||
#define pud_init pud_init
|
||||
extern void pmd_init(void *addr);
|
||||
#define pmd_init pmd_init
|
||||
extern void kernel_pte_init(void *addr);
|
||||
#define kernel_pte_init kernel_pte_init
|
||||
|
||||
/*
|
||||
* Encode/decode swap entries and swap PTEs. Swap PTEs are all PTEs that
|
||||
|
|
|
@ -317,7 +317,9 @@ static inline pmd_t *pud_pgtable(pud_t pud)
|
|||
*/
|
||||
extern void pgd_init(void *addr);
|
||||
extern void pud_init(void *addr);
|
||||
#define pud_init pud_init
|
||||
extern void pmd_init(void *addr);
|
||||
#define pmd_init pmd_init
|
||||
|
||||
/*
|
||||
* Encode/decode swap entries and swap PTEs. Swap PTEs are all PTEs that
|
||||
|
|
|
@ -3819,9 +3819,6 @@ void *sparse_buffer_alloc(unsigned long size);
|
|||
struct page * __populate_section_memmap(unsigned long pfn,
|
||||
unsigned long nr_pages, int nid, struct vmem_altmap *altmap,
|
||||
struct dev_pagemap *pgmap);
|
||||
void pud_init(void *addr);
|
||||
void pmd_init(void *addr);
|
||||
void kernel_pte_init(void *addr);
|
||||
pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
|
||||
p4d_t *vmemmap_p4d_populate(pgd_t *pgd, unsigned long addr, int node);
|
||||
pud_t *vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node);
|
||||
|
|
|
@ -90,6 +90,27 @@ static inline unsigned long pud_index(unsigned long address)
|
|||
#define pgd_index(a) (((a) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
|
||||
#endif
|
||||
|
||||
#ifndef kernel_pte_init
|
||||
static inline void kernel_pte_init(void *addr)
|
||||
{
|
||||
}
|
||||
#define kernel_pte_init kernel_pte_init
|
||||
#endif
|
||||
|
||||
#ifndef pmd_init
|
||||
static inline void pmd_init(void *addr)
|
||||
{
|
||||
}
|
||||
#define pmd_init pmd_init
|
||||
#endif
|
||||
|
||||
#ifndef pud_init
|
||||
static inline void pud_init(void *addr)
|
||||
{
|
||||
}
|
||||
#define pud_init pud_init
|
||||
#endif
|
||||
|
||||
#ifndef pte_offset_kernel
|
||||
static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address)
|
||||
{
|
||||
|
|
|
@ -106,10 +106,6 @@ static void __ref zero_pte_populate(pmd_t *pmd, unsigned long addr,
|
|||
}
|
||||
}
|
||||
|
||||
void __weak __meminit kernel_pte_init(void *addr)
|
||||
{
|
||||
}
|
||||
|
||||
static int __ref zero_pmd_populate(pud_t *pud, unsigned long addr,
|
||||
unsigned long end)
|
||||
{
|
||||
|
@ -145,10 +141,6 @@ static int __ref zero_pmd_populate(pud_t *pud, unsigned long addr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void __weak __meminit pmd_init(void *addr)
|
||||
{
|
||||
}
|
||||
|
||||
static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
|
||||
unsigned long end)
|
||||
{
|
||||
|
@ -187,10 +179,6 @@ static int __ref zero_pud_populate(p4d_t *p4d, unsigned long addr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void __weak __meminit pud_init(void *addr)
|
||||
{
|
||||
}
|
||||
|
||||
static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr,
|
||||
unsigned long end)
|
||||
{
|
||||
|
|
|
@ -184,10 +184,6 @@ static void * __meminit vmemmap_alloc_block_zero(unsigned long size, int node)
|
|||
return p;
|
||||
}
|
||||
|
||||
void __weak __meminit kernel_pte_init(void *addr)
|
||||
{
|
||||
}
|
||||
|
||||
pmd_t * __meminit vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node)
|
||||
{
|
||||
pmd_t *pmd = pmd_offset(pud, addr);
|
||||
|
@ -201,10 +197,6 @@ pmd_t * __meminit vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node)
|
|||
return pmd;
|
||||
}
|
||||
|
||||
void __weak __meminit pmd_init(void *addr)
|
||||
{
|
||||
}
|
||||
|
||||
pud_t * __meminit vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node)
|
||||
{
|
||||
pud_t *pud = pud_offset(p4d, addr);
|
||||
|
@ -218,10 +210,6 @@ pud_t * __meminit vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node)
|
|||
return pud;
|
||||
}
|
||||
|
||||
void __weak __meminit pud_init(void *addr)
|
||||
{
|
||||
}
|
||||
|
||||
p4d_t * __meminit vmemmap_p4d_populate(pgd_t *pgd, unsigned long addr, int node)
|
||||
{
|
||||
p4d_t *p4d = p4d_offset(pgd, addr);
|
||||
|
|
Loading…
Reference in a new issue