Commit ff26f70f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

mm/mmap.c: clean up CONFIG_DEBUG_VM_RB checks

- be consistent in printing the test which failed

- one message was actually wrong (a<b != b>a)

- don't print second bogus warning if browse_rb() failed

Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 57054651
...@@ -368,16 +368,18 @@ static int browse_rb(struct rb_root *root) ...@@ -368,16 +368,18 @@ static int browse_rb(struct rb_root *root)
struct vm_area_struct *vma; struct vm_area_struct *vma;
vma = rb_entry(nd, struct vm_area_struct, vm_rb); vma = rb_entry(nd, struct vm_area_struct, vm_rb);
if (vma->vm_start < prev) { if (vma->vm_start < prev) {
pr_emerg("vm_start %lx prev %lx\n", vma->vm_start, prev); pr_emerg("vm_start %lx < prev %lx\n",
vma->vm_start, prev);
bug = 1; bug = 1;
} }
if (vma->vm_start < pend) { if (vma->vm_start < pend) {
pr_emerg("vm_start %lx pend %lx\n", vma->vm_start, pend); pr_emerg("vm_start %lx < pend %lx\n",
vma->vm_start, pend);
bug = 1; bug = 1;
} }
if (vma->vm_start > vma->vm_end) { if (vma->vm_start > vma->vm_end) {
pr_emerg("vm_end %lx < vm_start %lx\n", pr_emerg("vm_start %lx > vm_end %lx\n",
vma->vm_end, vma->vm_start); vma->vm_start, vma->vm_end);
bug = 1; bug = 1;
} }
if (vma->rb_subtree_gap != vma_compute_subtree_gap(vma)) { if (vma->rb_subtree_gap != vma_compute_subtree_gap(vma)) {
...@@ -419,8 +421,10 @@ static void validate_mm(struct mm_struct *mm) ...@@ -419,8 +421,10 @@ static void validate_mm(struct mm_struct *mm)
int i = 0; int i = 0;
unsigned long highest_address = 0; unsigned long highest_address = 0;
struct vm_area_struct *vma = mm->mmap; struct vm_area_struct *vma = mm->mmap;
while (vma) { while (vma) {
struct anon_vma_chain *avc; struct anon_vma_chain *avc;
vma_lock_anon_vma(vma); vma_lock_anon_vma(vma);
list_for_each_entry(avc, &vma->anon_vma_chain, same_vma) list_for_each_entry(avc, &vma->anon_vma_chain, same_vma)
anon_vma_interval_tree_verify(avc); anon_vma_interval_tree_verify(avc);
...@@ -435,12 +439,13 @@ static void validate_mm(struct mm_struct *mm) ...@@ -435,12 +439,13 @@ static void validate_mm(struct mm_struct *mm)
} }
if (highest_address != mm->highest_vm_end) { if (highest_address != mm->highest_vm_end) {
pr_emerg("mm->highest_vm_end %lx, found %lx\n", pr_emerg("mm->highest_vm_end %lx, found %lx\n",
mm->highest_vm_end, highest_address); mm->highest_vm_end, highest_address);
bug = 1; bug = 1;
} }
i = browse_rb(&mm->mm_rb); i = browse_rb(&mm->mm_rb);
if (i != mm->map_count) { if (i != mm->map_count) {
pr_emerg("map_count %d rb %d\n", mm->map_count, i); if (i != -1)
pr_emerg("map_count %d rb %d\n", mm->map_count, i);
bug = 1; bug = 1;
} }
BUG_ON(bug); BUG_ON(bug);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment