@@ -42,6 +42,33 @@ const struct trace_print_flags vmaflag_names[] = {
{0, NULL}
};
+static void __dump_tail_page(struct page *page, int mapcount)
+{
+ struct page *head = compound_head(page);
+
+ if ((page < head) || (page >= head + MAX_ORDER_NR_PAGES)) {
+ /*
+ * Page is hopelessly corrupted, so limit any reporting to
+ * information about the page itself. Do not attempt to look at
+ * the head page.
+ */
+ pr_warn("page:%px refcount:%d mapcount:%d mapping:%px "
+ "index:%#lx (corrupted tail page case)\n",
+ page, page_ref_count(page), mapcount, page->mapping,
+ page_to_pgoff(page));
+ } else {
+ pr_warn("page:%px compound refcount:%d mapcount:%d mapping:%px "
+ "index:%#lx compound_mapcount:%d\n",
+ page, page_ref_count(head), mapcount, head->mapping,
+ page_to_pgoff(head), compound_mapcount(page));
+ }
+
+ if (page_ref_count(page) != 0) {
+ pr_warn("page:%px PROBLEM: non-zero refcount (==%d) on this "
+ "tail page\n", page, page_ref_count(page));
+ }
+}
+
void __dump_page(struct page *page, const char *reason)
{
struct address_space *mapping;
@@ -75,12 +102,8 @@ void __dump_page(struct page *page, const char *reason)
*/
mapcount = PageSlab(page) ? 0 : page_mapcount(page);
- if (PageCompound(page))
- pr_warn("page:%px refcount:%d mapcount:%d mapping:%px "
- "index:%#lx compound_mapcount: %d\n",
- page, page_ref_count(page), mapcount,
- page->mapping, page_to_pgoff(page),
- compound_mapcount(page));
+ if (PageTail(page))
+ __dump_tail_page(page, mapcount);
else
pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n",
page, page_ref_count(page), mapcount,