From: Nadav Amit <namit@xxxxxxxxxx> Add a pte_to_page(), which is similar to pmd_to_page, which will be used later. Inline pmd_to_page() as well. Signed-off-by: Nadav Amit <namit@xxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Andy Lutomirski <luto@xxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Cc: Nick Piggin <npiggin@xxxxxxxxx> Cc: Yu Zhao <yuzhao@xxxxxxxxxx> --- include/linux/mm.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ecdf8a8cd6ae..d78a79fbb012 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2161,6 +2161,13 @@ static inline spinlock_t *ptlock_ptr(struct page *page) } #endif /* ALLOC_SPLIT_PTLOCKS */ +static inline struct page *pte_to_page(pte_t *pte) +{ + unsigned long mask = ~(PTRS_PER_PTE * sizeof(pte_t) - 1); + + return virt_to_page((void *)((unsigned long) pte & mask)); +} + static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) { return ptlock_ptr(pmd_page(*pmd)); @@ -2246,7 +2253,7 @@ static inline void pgtable_pte_page_dtor(struct page *page) #if USE_SPLIT_PMD_PTLOCKS -static struct page *pmd_to_page(pmd_t *pmd) +static inline struct page *pmd_to_page(pmd_t *pmd) { unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); return virt_to_page((void *)((unsigned long) pmd & mask)); -- 2.25.1