Re: [PATCH 04/18] ARC: mm: remove pgd_offset_fast

From: Mike Rapoport
Date: Wed Aug 11 2021 - 01:12:15 EST


On Tue, Aug 10, 2021 at 05:42:44PM -0700, Vineet Gupta wrote:
> Signed-off-by: Vineet Gupta <vgupta@xxxxxxxxxx>
> ---
> arch/arc/include/asm/pgtable.h | 23 -----------------------
> arch/arc/mm/fault.c | 2 +-
> 2 files changed, 1 insertion(+), 24 deletions(-)

Shouldn't this be a part of the patch that removed usage of the scratch reg
for pgd?

> diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
> index 0c3e220bd2b4..80b57c14b430 100644
> --- a/arch/arc/include/asm/pgtable.h
> +++ b/arch/arc/include/asm/pgtable.h
> @@ -284,29 +284,6 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
> set_pte(ptep, pteval);
> }
>
> -/*
> - * Macro to quickly access the PGD entry, utlising the fact that some
> - * arch may cache the pointer to Page Directory of "current" task
> - * in a MMU register
> - *
> - * Thus task->mm->pgd (3 pointer dereferences, cache misses etc simply
> - * becomes read a register
> - *
> - * ********CAUTION*******:
> - * Kernel code might be dealing with some mm_struct of NON "current"
> - * Thus use this macro only when you are certain that "current" is current
> - * e.g. when dealing with signal frame setup code etc
> - */
> -#ifdef ARC_USE_SCRATCH_REG
> -#define pgd_offset_fast(mm, addr) \
> -({ \
> - pgd_t *pgd_base = (pgd_t *) read_aux_reg(ARC_REG_SCRATCH_DATA0); \
> - pgd_base + pgd_index(addr); \
> -})
> -#else
> -#define pgd_offset_fast(mm, addr) pgd_offset(mm, addr)
> -#endif
> -
> extern pgd_t swapper_pg_dir[] __aligned(PAGE_SIZE);
> void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
> pte_t *ptep);
> diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
> index f5657cb68e4f..41f154320964 100644
> --- a/arch/arc/mm/fault.c
> +++ b/arch/arc/mm/fault.c
> @@ -33,7 +33,7 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address)
> pud_t *pud, *pud_k;
> pmd_t *pmd, *pmd_k;
>
> - pgd = pgd_offset_fast(current->active_mm, address);
> + pgd = pgd_offset(current->active_mm, address);
> pgd_k = pgd_offset_k(address);
>
> if (!pgd_present(*pgd_k))
> --
> 2.25.1
>

--
Sincerely yours,
Mike.