History

mm: Allow arches to provide ptep_get()

Since commit 9e343b467c70 ("READ_ONCE: Enforce atomicity for {READ,WRITE}_ONCE() memory accesses") it is not possible anymore to use READ_ONCE() to access complex page table entries like the one defined for powerpc 8xx with 16k size pages. Define a ptep_get() helper that architectures can override instead of performing a READ_ONCE() on the page table entry pointer.

Christophe Leroy committed 6 years ago

Commit 481e9801 parent 55ca2263 files · +9 −2Browse files

Unified · Split

3 files
  1. include/asm-generic/hugetlb.h +1 −1
  2. include/linux/pgtable.h +7 −0
  3. mm/gup.c +1 −1
include/asm-generic/hugetlb.h+1−1
@@ -122,7 +122,7 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 121 unmodified lines
122122 #ifndef __HAVE_ARCH_HUGE_PTEP_GET
123123 static inline pte_t huge_ptep_get(pte_t *ptep)
124124 {
125− return READ_ONCE(*ptep);
125+ return ptep_get(ptep);
126126 }
127127 #endif
128128
include/linux/pgtable.h+7−0
@@ -249,6 +249,13 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, · 248 unmodified lines
249249 }
250250 #endif
251251
252+#ifndef __HAVE_ARCH_PTEP_GET
253+static inline pte_t ptep_get(pte_t *ptep)
254+{
255+ return READ_ONCE(*ptep);
256+}
257+#endif
258+
252259 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
253260 #ifndef __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR
254261 static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
mm/gup.c+1−1
@@ -2196,7 +2196,7 @@ static inline pte_t gup_get_pte(pte_t *ptep) · 2195 unmodified lines
21962196 */
21972197 static inline pte_t gup_get_pte(pte_t *ptep)
21982198 {
2199− return READ_ONCE(*ptep);
2199+ return ptep_get(ptep);
22002200 }
22012201 #endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */
22022202