Re: [PATCH V4 26/26] mm/mmap: Drop ARCH_HAS_VM_GET_PAGE_PROT

Christophe Leroy
2022-06-24T05:29:52Z

Le 24/06/2022 à 06:43, Anshuman Khandual a écrit :
> Now all the platforms enable ARCH_HAS_GET_PAGE_PROT. They define and export
> own vm_get_page_prot() whether custom or standard DECLARE_VM_GET_PAGE_PROT.
> Hence there is no need for default generic fallback for vm_get_page_prot().
> Just drop this fallback and also ARCH_HAS_GET_PAGE_PROT mechanism.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> arch/alpha/Kconfig | 1 -
> arch/arc/Kconfig | 1 -
> arch/arm/Kconfig | 1 -
> arch/arm64/Kconfig | 1 -
> arch/csky/Kconfig | 1 -
> arch/hexagon/Kconfig | 1 -
> arch/ia64/Kconfig | 1 -
> arch/loongarch/Kconfig | 1 -
> arch/m68k/Kconfig | 1 -
> arch/microblaze/Kconfig | 1 -
> arch/mips/Kconfig | 1 -
> arch/nios2/Kconfig | 1 -
> arch/openrisc/Kconfig | 1 -
> arch/parisc/Kconfig | 1 -
> arch/powerpc/Kconfig | 1 -
> arch/riscv/Kconfig | 1 -
> arch/s390/Kconfig | 1 -
> arch/sh/Kconfig | 1 -
> arch/sparc/Kconfig | 1 -
> arch/um/Kconfig | 1 -
> arch/x86/Kconfig | 1 -
> arch/xtensa/Kconfig | 1 -
> include/linux/mm.h | 3 ---
> mm/Kconfig | 3 ---
> mm/mmap.c | 22 ----------------------
> 25 files changed, 50 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 43db3bd49071..3557fe83d124 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -101,28 +101,6 @@ static void unmap_region(struct mm_struct *mm,
> * w: (no) no
> * x: (yes) yes
> */

The above comment is not orphaned. I think it should go in linux/mm.h

> -#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT
> -pgprot_t protection_map[16] __ro_after_init = {
> - [VM_NONE] = __P000,
> - [VM_READ] = __P001,
> - [VM_WRITE] = __P010,
> - [VM_WRITE | VM_READ] = __P011,
> - [VM_EXEC] = __P100,
> - [VM_EXEC | VM_READ] = __P101,
> - [VM_EXEC | VM_WRITE] = __P110,
> - [VM_EXEC | VM_WRITE | VM_READ] = __P111,
> - [VM_SHARED] = __S000,
> - [VM_SHARED | VM_READ] = __S001,
> - [VM_SHARED | VM_WRITE] = __S010,
> - [VM_SHARED | VM_WRITE | VM_READ] = __S011,
> - [VM_SHARED | VM_EXEC] = __S100,
> - [VM_SHARED | VM_EXEC | VM_READ] = __S101,
> - [VM_SHARED | VM_EXEC | VM_WRITE] = __S110,
> - [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = __S111
> -};
> -DECLARE_VM_GET_PAGE_PROT
> -#endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */
> -
> static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
> {
> return pgprot_modify(oldprot, vm_get_page_prot(vm_flags));