riscv: mm: Remove the copy operation of pmd
Since all processes share the kernel address space, we only need to copy pgd in case of a vmalloc page fault exception, the other levels of page tables are shared, so the operation of copying pmd is unnecessary. Signed-off-by: Chuanhua Han <hanchuanhua@oppo.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
parent
3123109284
commit
7da9ca3f5b
@ -102,9 +102,9 @@ static inline void bad_area(struct pt_regs *regs, struct mm_struct *mm, int code
|
|||||||
static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long addr)
|
static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long addr)
|
||||||
{
|
{
|
||||||
pgd_t *pgd, *pgd_k;
|
pgd_t *pgd, *pgd_k;
|
||||||
pud_t *pud, *pud_k;
|
pud_t *pud_k;
|
||||||
p4d_t *p4d, *p4d_k;
|
p4d_t *p4d_k;
|
||||||
pmd_t *pmd, *pmd_k;
|
pmd_t *pmd_k;
|
||||||
pte_t *pte_k;
|
pte_t *pte_k;
|
||||||
int index;
|
int index;
|
||||||
unsigned long pfn;
|
unsigned long pfn;
|
||||||
@ -132,14 +132,12 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
|
|||||||
}
|
}
|
||||||
set_pgd(pgd, *pgd_k);
|
set_pgd(pgd, *pgd_k);
|
||||||
|
|
||||||
p4d = p4d_offset(pgd, addr);
|
|
||||||
p4d_k = p4d_offset(pgd_k, addr);
|
p4d_k = p4d_offset(pgd_k, addr);
|
||||||
if (!p4d_present(*p4d_k)) {
|
if (!p4d_present(*p4d_k)) {
|
||||||
no_context(regs, addr);
|
no_context(regs, addr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pud = pud_offset(p4d, addr);
|
|
||||||
pud_k = pud_offset(p4d_k, addr);
|
pud_k = pud_offset(p4d_k, addr);
|
||||||
if (!pud_present(*pud_k)) {
|
if (!pud_present(*pud_k)) {
|
||||||
no_context(regs, addr);
|
no_context(regs, addr);
|
||||||
@ -150,13 +148,11 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
|
|||||||
* Since the vmalloc area is global, it is unnecessary
|
* Since the vmalloc area is global, it is unnecessary
|
||||||
* to copy individual PTEs
|
* to copy individual PTEs
|
||||||
*/
|
*/
|
||||||
pmd = pmd_offset(pud, addr);
|
|
||||||
pmd_k = pmd_offset(pud_k, addr);
|
pmd_k = pmd_offset(pud_k, addr);
|
||||||
if (!pmd_present(*pmd_k)) {
|
if (!pmd_present(*pmd_k)) {
|
||||||
no_context(regs, addr);
|
no_context(regs, addr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
set_pmd(pmd, *pmd_k);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the actual PTE exists as well to
|
* Make sure the actual PTE exists as well to
|
||||||
|
Loading…
Reference in New Issue
Block a user