Linux-MIPS Archive on
 help / color / Atom feed
* [PATCH v15 05/23] mips: mm: Add p?d_leaf() definitions
       [not found] <>
@ 2019-11-01 14:09 ` Steven Price
  0 siblings, 0 replies; only message in thread
From: Steven Price @ 2019-11-01 14:09 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: Steven Price, Andy Lutomirski, Ard Biesheuvel, Arnd Bergmann,
	Borislav Petkov, Catalin Marinas, Dave Hansen, Ingo Molnar,
	James Morse, Jérôme Glisse, Peter Zijlstra,
	Thomas Gleixner, Will Deacon, x86, H. Peter Anvin,
	linux-arm-kernel, linux-kernel, Mark Rutland, Liang, Kan,
	Ralf Baechle, Paul Burton, James Hogan, linux-mips

walk_page_range() is going to be allowed to walk page tables other than
those of user space. For this it needs to know when it has reached a
'leaf' entry in the page tables. This information is provided by the
p?d_leaf() functions/macros.

If _PAGE_HUGE is defined we can simply look for it. When not defined we
can be confident that there are no leaf pages in existence and fall back
on the generic implementation (added in a later patch) which returns 0.

CC: Ralf Baechle <>
CC: Paul Burton <>
CC: James Hogan <>
Signed-off-by: Steven Price <>
Acked-by: Paul Burton <>
 arch/mips/include/asm/pgtable.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index f85bd5b15f51..fff392ea80c7 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -639,6 +639,11 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
+#ifdef _PAGE_HUGE
+#define pmd_leaf(pmd)	((pmd_val(pmd) & _PAGE_HUGE) != 0)
+#define pud_leaf(pud)	((pud_val(pud) & _PAGE_HUGE) != 0)
 #define gup_fast_permitted(start, end)	(!cpu_has_dc_aliases)
 #include <asm-generic/pgtable.h>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
2019-11-01 14:09 ` [PATCH v15 05/23] mips: mm: Add p?d_leaf() definitions Steven Price

Linux-MIPS Archive on

Archives are clonable:
	git clone --mirror linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ \
	public-inbox-index linux-mips

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone