diff mbox series

[RFC,12/13] mm: simplify the printing with '%pd' specifier

Message ID 20210715031533.9553-13-justin.he@arm.com (mailing list archive)
State New
Headers show
Series None | expand

Commit Message

Jia He July 15, 2021, 3:15 a.m. UTC
Use '%pd' to simplify the printing since kbasename(file_path()) is to
get the last dentry of the full path.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jia He <justin.he@arm.com>
---
 mm/memory.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
diff mbox series

Patch

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);
 }