[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220429133552.33768-8-zhengqi.arch@bytedance.com>
Date: Fri, 29 Apr 2022 21:35:41 +0800
From: Qi Zheng <zhengqi.arch@...edance.com>
To: akpm@...ux-foundation.org, tglx@...utronix.de,
kirill.shutemov@...ux.intel.com, mika.penttila@...tfour.com,
david@...hat.com, jgg@...dia.com, tj@...nel.org, dennis@...nel.org,
ming.lei@...hat.com
Cc: linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, songmuchun@...edance.com,
zhouchengming@...edance.com, Qi Zheng <zhengqi.arch@...edance.com>
Subject: [RFC PATCH 07/18] mm: add pte_to_page() helper
Add pte_to_page() helper similar to pmd_to_page(), which
will be used to get the struct page of the PTE page table.
Signed-off-by: Qi Zheng <zhengqi.arch@...edance.com>
---
include/linux/pgtable.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 0928acca6b48..d1218cb1013e 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -85,6 +85,14 @@ static inline unsigned long pud_index(unsigned long address)
#define pgd_index(a) (((a) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
#endif
+#ifdef CONFIG_FREE_USER_PTE
+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));
+}
+#endif
+
#if USE_SPLIT_PTE_PTLOCKS
#if ALLOC_SPLIT_PTLOCKS
void __init ptlock_cache_init(void);
--
2.20.1
Powered by blists - more mailing lists