aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2016-09-19 17:44:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-09-19 18:36:16 -0400
commit4d35427ad7641cba08ea0deffae1a78147ad41c0 (patch)
tree832a652ea61f198004cd27bfa8cc56a24087d422 /mm
parent982785c6b05a82c01e90687b7e25ee87c8970b2e (diff)
mm: avoid endless recursion in dump_page()
dump_page() uses page_mapcount() to get mapcount of the page. page_mapcount() has VM_BUG_ON_PAGE(PageSlab(page)) as mapcount doesn't make sense for slab pages and the field in struct page used for other information. It leads to recursion if dump_page() called for slub page and DEBUG_VM is enabled: dump_page() -> page_mapcount() -> VM_BUG_ON_PAGE() -> dump_page -> ... Let's avoid calling page_mapcount() for slab pages in dump_page(). Link: http://lkml.kernel.org/r/20160908082137.131076-1-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/debug.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/debug.c b/mm/debug.c
index 8865bfb41b0b..74c7cae4f683 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -42,9 +42,11 @@ const struct trace_print_flags vmaflag_names[] = {
42 42
43void __dump_page(struct page *page, const char *reason) 43void __dump_page(struct page *page, const char *reason)
44{ 44{
45 int mapcount = PageSlab(page) ? 0 : page_mapcount(page);
46
45 pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx", 47 pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx",
46 page, page_ref_count(page), page_mapcount(page), 48 page, page_ref_count(page), mapcount,
47 page->mapping, page->index); 49 page->mapping, page_to_pgoff(page));
48 if (PageCompound(page)) 50 if (PageCompound(page))
49 pr_cont(" compound_mapcount: %d", compound_mapcount(page)); 51 pr_cont(" compound_mapcount: %d", compound_mapcount(page));
50 pr_cont("\n"); 52 pr_cont("\n");