Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hugetlb: introduce generic version of huge_ptep_set_access_flags()

arm, ia64, sh, x86 architectures use the same version
of huge_ptep_set_access_flags, so move this generic implementation
into asm-generic/hugetlb.h.

Link: http://lkml.kernel.org/r/20180920060358.16606-11-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Tested-by: Helge Deller <deller@gmx.de> [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com> [arm64]
Acked-by: Paul Burton <paul.burton@mips.com> [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org> [x86]
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alexandre Ghiti and committed by
Linus Torvalds
facf6d5b 8e581d43

+14 -28
-7
arch/arm/include/asm/hugetlb-3level.h
··· 37 37 return retval; 38 38 } 39 39 40 - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, 41 - unsigned long addr, pte_t *ptep, 42 - pte_t pte, int dirty) 43 - { 44 - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); 45 - } 46 - 47 40 #endif /* _ASM_ARM_HUGETLB_3LEVEL_H */
+1
arch/arm64/include/asm/hugetlb.h
··· 42 42 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT 43 43 extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, 44 44 pte_t *ptep, pte_t pte); 45 + #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS 45 46 extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, 46 47 unsigned long addr, pte_t *ptep, 47 48 pte_t pte, int dirty);
-7
arch/ia64/include/asm/hugetlb.h
··· 27 27 { 28 28 } 29 29 30 - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, 31 - unsigned long addr, pte_t *ptep, 32 - pte_t pte, int dirty) 33 - { 34 - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); 35 - } 36 - 37 30 static inline pte_t huge_ptep_get(pte_t *ptep) 38 31 { 39 32 return *ptep;
+1
arch/mips/include/asm/hugetlb.h
··· 63 63 return !val || (val == (unsigned long)invalid_pte_table); 64 64 } 65 65 66 + #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS 66 67 static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, 67 68 unsigned long addr, 68 69 pte_t *ptep, pte_t pte,
+1
arch/parisc/include/asm/hugetlb.h
··· 43 43 void huge_ptep_set_wrprotect(struct mm_struct *mm, 44 44 unsigned long addr, pte_t *ptep); 45 45 46 + #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS 46 47 int huge_ptep_set_access_flags(struct vm_area_struct *vma, 47 48 unsigned long addr, pte_t *ptep, 48 49 pte_t pte, int dirty);
+1
arch/powerpc/include/asm/hugetlb.h
··· 134 134 flush_hugetlb_page(vma, addr); 135 135 } 136 136 137 + #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS 137 138 extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, 138 139 unsigned long addr, pte_t *ptep, 139 140 pte_t pte, int dirty);
-7
arch/sh/include/asm/hugetlb.h
··· 32 32 { 33 33 } 34 34 35 - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, 36 - unsigned long addr, pte_t *ptep, 37 - pte_t pte, int dirty) 38 - { 39 - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); 40 - } 41 - 42 35 static inline pte_t huge_ptep_get(pte_t *ptep) 43 36 { 44 37 return *ptep;
+1
arch/sparc/include/asm/hugetlb.h
··· 40 40 set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); 41 41 } 42 42 43 + #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS 43 44 static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, 44 45 unsigned long addr, pte_t *ptep, 45 46 pte_t pte, int dirty)
-7
arch/x86/include/asm/hugetlb.h
··· 13 13 return 0; 14 14 } 15 15 16 - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, 17 - unsigned long addr, pte_t *ptep, 18 - pte_t pte, int dirty) 19 - { 20 - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); 21 - } 22 - 23 16 static inline pte_t huge_ptep_get(pte_t *ptep) 24 17 { 25 18 return *ptep;
+9
include/asm-generic/hugetlb.h
··· 110 110 } 111 111 #endif 112 112 113 + #ifndef __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS 114 + static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, 115 + unsigned long addr, pte_t *ptep, 116 + pte_t pte, int dirty) 117 + { 118 + return ptep_set_access_flags(vma, addr, ptep, pte, dirty); 119 + } 120 + #endif 121 + 113 122 #endif /* _ASM_GENERIC_HUGETLB_H */