summaryrefslogtreecommitdiff
path: root/include/linux/pgtable.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-11-13 13:45:36 +0300
committerPeter Zijlstra <peterz@infradead.org>2020-12-03 12:14:50 +0300
commit560dabbdf68bb15f9e241af8f828b1c8c38d6c6f (patch)
tree4ba7e4ceb4370c9242791161b88c01d6afc1e880 /include/linux/pgtable.h
parent2a4a06da8a4b93dd189171eed7a99fffd38f42f3 (diff)
downloadlinux-560dabbdf68bb15f9e241af8f828b1c8c38d6c6f.tar.xz
mm: Introduce pXX_leaf_size()
A number of architectures have non-pagetable aligned huge/large pages. For such architectures a leaf can actually be part of a larger entry. Provide generic helpers to determine the size of a page-table leaf. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Link: https://lkml.kernel.org/r/20201126121121.102580109@infradead.org
Diffstat (limited to 'include/linux/pgtable.h')
-rw-r--r--include/linux/pgtable.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index ed9266cc115b..fefbbdbbb3f3 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -1536,4 +1536,20 @@ typedef unsigned int pgtbl_mod_mask;
#define pmd_leaf(x) 0
#endif
+#ifndef pgd_leaf_size
+#define pgd_leaf_size(x) (1ULL << PGDIR_SHIFT)
+#endif
+#ifndef p4d_leaf_size
+#define p4d_leaf_size(x) P4D_SIZE
+#endif
+#ifndef pud_leaf_size
+#define pud_leaf_size(x) PUD_SIZE
+#endif
+#ifndef pmd_leaf_size
+#define pmd_leaf_size(x) PMD_SIZE
+#endif
+#ifndef pte_leaf_size
+#define pte_leaf_size(x) PAGE_SIZE
+#endif
+
#endif /* _LINUX_PGTABLE_H */