Skip to content

Commit 6c1d2a0

Browse files
Ryan Robertsakpm00
Ryan Roberts
authored andcommitted
mm: move ptep_get() and pmdp_get() helpers
There are many call sites that directly dereference a pte_t pointer. This makes it very difficult to properly encapsulate a page table in the arch code without having to allocate shadow page tables. We will shortly solve this by replacing all the call sites with ptep_get() calls. But there are call sites above the function definition in the header file, so let's move ptep_get() to an earlier location to solve that problem. And move pmdp_get() at the same time to keep it close to ptep_get(). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ryan Roberts <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Al Viro <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Dimitri Sivanich <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Jérôme Glisse <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: kernel test robot <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Miaohe Lin <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Mike Rapoport (IBM) <[email protected]> Cc: Muchun Song <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Oleksandr Tyshchenko <[email protected]> Cc: Pavel Tatashin <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: SeongJae Park <[email protected]> Cc: Shakeel Butt <[email protected]> Cc: Uladzislau Rezki (Sony) <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: Yu Zhao <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 426931e commit 6c1d2a0

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

include/linux/pgtable.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,20 @@ static inline int pudp_set_access_flags(struct vm_area_struct *vma,
212212
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
213213
#endif
214214

215+
#ifndef ptep_get
216+
static inline pte_t ptep_get(pte_t *ptep)
217+
{
218+
return READ_ONCE(*ptep);
219+
}
220+
#endif
221+
222+
#ifndef pmdp_get
223+
static inline pmd_t pmdp_get(pmd_t *pmdp)
224+
{
225+
return READ_ONCE(*pmdp);
226+
}
227+
#endif
228+
215229
#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
216230
static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
217231
unsigned long address,
@@ -317,20 +331,6 @@ static inline void ptep_clear(struct mm_struct *mm, unsigned long addr,
317331
ptep_get_and_clear(mm, addr, ptep);
318332
}
319333

320-
#ifndef ptep_get
321-
static inline pte_t ptep_get(pte_t *ptep)
322-
{
323-
return READ_ONCE(*ptep);
324-
}
325-
#endif
326-
327-
#ifndef pmdp_get
328-
static inline pmd_t pmdp_get(pmd_t *pmdp)
329-
{
330-
return READ_ONCE(*pmdp);
331-
}
332-
#endif
333-
334334
#ifdef CONFIG_GUP_GET_PXX_LOW_HIGH
335335
/*
336336
* For walking the pagetables without holding any locks. Some architectures

0 commit comments

Comments
 (0)