[PATCH] Do not print page type when the page has no type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is confusing and unnecessary to print the page type when the
page has no type.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

---

I did not run the test-suite.  I'm in the middle of debugging something
else and this is an unwelcome distraction.  If this doesn't work quite
right, please fix it.

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 1c68d67b832f..3ac7b7e697a3 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -903,14 +903,9 @@ static inline bool is_page_hwpoison(struct page *page)
 #define PageType(page, flag)						\
 	((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE)
 
-static inline int page_type_has_type(unsigned int page_type)
-{
-	return (int)page_type < PAGE_MAPCOUNT_RESERVE;
-}
-
 static inline int page_has_type(struct page *page)
 {
-	return page_type_has_type(page->page_type);
+	return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
 }
 
 #define PAGE_TYPE_OPS(uname, lname)					\
diff --git a/lib/test_printf.c b/lib/test_printf.c
index 7677ebccf3c3..442e4c41bccb 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -648,9 +648,7 @@ static void __init page_type_test(unsigned int page_type, const char *name,
 	unsigned long size;
 
 	size = scnprintf(cmp_buf, BUF_SIZE, "%#x(", page_type);
-	if (page_type_has_type(page_type))
-		size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
-
+	size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
 	snprintf(cmp_buf + size, BUF_SIZE - size, ")");
 	test(cmp_buf, "%pGt", &page_type);
 }
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 40f560959b16..0a0e5c4cffc9 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2061,8 +2061,7 @@ char *format_page_type(char *buf, char *end, unsigned int page_type)
 		*buf = '(';
 	buf++;
 
-	if (page_type_has_type(page_type))
-		buf = format_flags(buf, end, ~page_type, pagetype_names);
+	buf = format_flags(buf, end, ~page_type, pagetype_names);
 
 	if (buf < end)
 		*buf = ')';
diff --git a/mm/debug.c b/mm/debug.c
index c7b228097bd9..6eb0ecb9b368 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -120,7 +120,8 @@ static void __dump_page(struct page *page)
 
 	pr_warn("%sflags: %pGp%s\n", type, &head->flags,
 		page_cma ? " CMA" : "");
-	pr_warn("page_type: %pGt\n", &head->page_type);
+	if (page_has_type(head))
+		pr_warn("page_type: %pGt\n", &head->page_type);
 
 	print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
 			sizeof(unsigned long), page,




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux