Skip to contentSkip to conversation

mm: pagewalk: allow walking without vma

PATCH In review [email protected] 1 participant 1 message Dec 1, 2019

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 57/158 mm: pagewalk: allow walking without vma

From: Steven Price <[email protected]>
Subject: mm: pagewalk: allow walking without vma

Since 48684a65b4e3: "mm: pagewalk: fix misbehavior of walk_page_range for vma(VM_PFNMAP)", page_table_walk() will report any kernel area as a hole, because it lacks a vma.

This means each arch has re-implemented page table walking when needed, for example in the per-arch ptdump walker.

Remove the requirement to have a vma in the generic code and add a new function walk_page_range_novma() which ignores the VMAs and simply walks the page tables.

[[email protected]: fix boot crash]
Cc Zong Li <[email protected]>
Cc Naoya Horiguchi <[email protected]>
Cc Shiraz Hashim <[email protected]>
Cc Albert Ou <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Alexandre Ghiti <[email protected]>
Cc Andrey Ryabinin <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Dave Jiang <[email protected]>
Cc David S. Miller <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc James Hogan <[email protected]>
Cc James Morse <[email protected]>
Cc "Liang, Kan" <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Paul Burton <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Russell King <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Vineet Gupta <[email protected]>
Cc Will Deacon <[email protected]>
Cc Qian Cai <[email protected]>
Cc Stephen Rothwell <[email protected]>

---

 include/linux/pagewalk.h |    5 ++++
 mm/pagewalk.c            |   44 ++++++++++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 8 deletions(-)
include/linux/pagewalk.h renamed from include/linux/pagewalk.h~mm-pagewalk-allow-walking-without-vma +5 -0
@@ -59,6 +59,7 @@ struct mm_walk_ops {
  * @ops:	operation to call during the walk
  * @mm:		mm_struct representing the target process of page table walk
  * @vma:	vma currently walked (NULL if walking outside vmas)
+ * @no_vma:	walk ignoring vmas (vma will always be NULL)
  * @private:	private data for callbacks' usage
  *
  * (see the comment on walk_page_range() for more details)
@@ -67,12 +68,16 @@ struct mm_walk {
 	const struct mm_walk_ops *ops;
 	struct mm_struct *mm;
 	struct vm_area_struct *vma;
+	bool no_vma;
 	void *private;
 };
 
 int walk_page_range(struct mm_struct *mm, unsigned long start,
 		unsigned long end, const struct mm_walk_ops *ops,
 		void *private);
+int walk_page_range_novma(struct mm_struct *mm, unsigned long start,
+			  unsigned long end, const struct mm_walk_ops *ops,
+			  void *private);
 int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
 		void *private);
 int walk_page_mapping(struct address_space *mapping, pgoff_t first_index,
mm/pagewalk.c renamed from mm/pagewalk.c~mm-pagewalk-allow-walking-without-vma +36 -8

74 lines not on this page · raw message

_