[92/94] mm: Return a bool from anon_vma_interval_tree_verify()
diff mbox series

Message ID 20210428153542.2814175-93-Liam.Howlett@Oracle.com
State New, archived
Headers show
Series
  • Introducing the Maple Tree
Related show

Commit Message

Liam Howlett April 28, 2021, 3:36 p.m. UTC
Added to allow printing which vma has the issue

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 include/linux/mm.h | 2 +-
 mm/interval_tree.c | 6 +++---
 mm/mmap.c          | 7 +++++--
 3 files changed, 9 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/include/linux/mm.h b/include/linux/mm.h
index e1f1ae32fa9d..6bf5369ad319 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2526,7 +2526,7 @@  anon_vma_interval_tree_iter_first(struct rb_root_cached *root,
 struct anon_vma_chain *anon_vma_interval_tree_iter_next(
 	struct anon_vma_chain *node, unsigned long start, unsigned long last);
 #ifdef CONFIG_DEBUG_VM_RB
-void anon_vma_interval_tree_verify(struct anon_vma_chain *node);
+bool anon_vma_interval_tree_verify(struct anon_vma_chain *node);
 #endif
 
 #define anon_vma_interval_tree_foreach(avc, root, start, last)		 \
diff --git a/mm/interval_tree.c b/mm/interval_tree.c
index 32e390c42c53..5958e27d4381 100644
--- a/mm/interval_tree.c
+++ b/mm/interval_tree.c
@@ -103,9 +103,9 @@  anon_vma_interval_tree_iter_next(struct anon_vma_chain *node,
 }
 
 #ifdef CONFIG_DEBUG_VM_RB
-void anon_vma_interval_tree_verify(struct anon_vma_chain *node)
+bool anon_vma_interval_tree_verify(struct anon_vma_chain *node)
 {
-	WARN_ON_ONCE(node->cached_vma_start != avc_start_pgoff(node));
-	WARN_ON_ONCE(node->cached_vma_last != avc_last_pgoff(node));
+	return WARN_ON_ONCE(node->cached_vma_start != avc_start_pgoff(node)) ||
+		WARN_ON_ONCE(node->cached_vma_last != avc_last_pgoff(node));
 }
 #endif
diff --git a/mm/mmap.c b/mm/mmap.c
index c2baf006bcde..ae1ffe726405 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -326,8 +326,10 @@  static void validate_mm(struct mm_struct *mm)
 		struct anon_vma_chain *avc;
 		if (anon_vma) {
 			anon_vma_lock_read(anon_vma);
-			list_for_each_entry(avc, &vma->anon_vma_chain, same_vma)
-				anon_vma_interval_tree_verify(avc);
+			list_for_each_entry(avc, &vma->anon_vma_chain, same_vma) {
+				if (anon_vma_interval_tree_verify(avc))
+					pr_warn("Interval tree issue in %px", vma);
+			}
 			anon_vma_unlock_read(anon_vma);
 		}
 #endif
@@ -339,6 +341,7 @@  static void validate_mm(struct mm_struct *mm)
 		pr_emerg("map_count %d mas_for_each %d\n", mm->map_count, i);
 		bug = 1;
 	}
+
 	VM_BUG_ON_MM(bug, mm);
 }