Commit de7e71ef authored by Linus Torvalds's avatar Linus Torvalds

mm: simplify and improve print_vma_addr() output

Use '%pD' to print out the filename, and print out the actual offset
within the file too, rather than just what the virtual address of the
mapping is (which doesn't tell you anything about any mapping offsets).

Also, use the exact vma_lookup() instead of find_vma() - the latter
looks up any vma _after_ the address, which is of questionable value
(yes, maybe you fell off the beginning, but you'd be more likely to fall
off the end).
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f8a6e48c
...@@ -6210,21 +6210,14 @@ void print_vma_addr(char *prefix, unsigned long ip) ...@@ -6210,21 +6210,14 @@ void print_vma_addr(char *prefix, unsigned long ip)
if (!mmap_read_trylock(mm)) if (!mmap_read_trylock(mm))
return; return;
vma = find_vma(mm, ip); vma = vma_lookup(mm, ip);
if (vma && vma->vm_file) { if (vma && vma->vm_file) {
struct file *f = vma->vm_file; struct file *f = vma->vm_file;
char *buf = (char *)__get_free_page(GFP_NOWAIT); ip -= vma->vm_start;
if (buf) { ip += vma->vm_pgoff << PAGE_SHIFT;
char *p; printk("%s%pD[%lx,%lx+%lx]", prefix, f, ip,
vma->vm_start,
p = file_path(f, buf, PAGE_SIZE); vma->vm_end - vma->vm_start);
if (IS_ERR(p))
p = "?";
printk("%s%s[%lx+%lx]", prefix, kbasename(p),
vma->vm_start,
vma->vm_end - vma->vm_start);
free_page((unsigned long)buf);
}
} }
mmap_read_unlock(mm); mmap_read_unlock(mm);
} }
......
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