Use '%pd' to simplify the printing since kbasename(file_path()) is to get the last dentry of the full path. Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: linux-mm@xxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx Signed-off-by: Jia He <justin.he@xxxxxxx> --- mm/memory.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 747a01d495f2..350692ada6f7 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5217,18 +5217,14 @@ void print_vma_addr(char *prefix, unsigned long ip) vma = find_vma(mm, ip); if (vma && vma->vm_file) { struct file *f = vma->vm_file; - char *buf = (char *)__get_free_page(GFP_NOWAIT); - if (buf) { - char *p; - - p = file_path(f, buf, PAGE_SIZE); - if (IS_ERR(p)) - p = "?"; - printk("%s%s[%lx+%lx]", prefix, kbasename(p), + + if (f) + printk("%s%pd[%lx+%lx]", prefix, f->f_path.dentry, vma->vm_start, vma->vm_end - vma->vm_start); - free_page((unsigned long)buf); - } + else + printk("%s?[%lx+%lx]", prefix, vma->vm_start, + vma->vm_end - vma->vm_start); } mmap_read_unlock(mm); } -- 2.17.1