[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210131001132.3368247-11-namit@vmware.com>
Date: Sat, 30 Jan 2021 16:11:22 -0800
From: Nadav Amit <nadav.amit@...il.com>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: Nadav Amit <namit@...are.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will@...nel.org>, Nick Piggin <npiggin@...il.com>,
Yu Zhao <yuzhao@...gle.com>
Subject: [RFC 10/20] mm: add pte_to_page()
From: Nadav Amit <namit@...are.com>
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@...are.com>
Cc: Andrea Arcangeli <aarcange@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Will Deacon <will@...nel.org>
Cc: Nick Piggin <npiggin@...il.com>
Cc: Yu Zhao <yuzhao@...gle.com>
---
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
Powered by blists - more mailing lists