From 0249af9c0e0ba7c64d48238b9d6757af4e14280f Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Fri, 21 May 2021 11:02:33 -0700 Subject: [PATCH] ANDROID: mm: page_alloc: skip dump pages for freeable page We have seen following dumps from alloc_contig_dump_pages. 05-20 20:04:41.847 1000 503 503 W page : 00000000691ab336 refcount:1 mapcount:0 mapping:0000000000000000 index:0x72aa2d7 pfn:0x9e912e 05-20 20:04:41.847 1000 503 503 W anon flags: 0x8000000000080004(uptodate|swapbacked) 05-20 20:04:41.847 1000 503 503 W raw : 8000000000080004 ffffffff25844b48 ffffffff25844bc8 ffffff89824e46c1 05-20 20:04:41.847 1000 503 503 W raw : 00000000072aa2d7 0000000000000000 00000001ffffffff 0000000000000000 05-20 20:04:41.847 1000 503 503 W : page dumped because: migration failure 05-20 20:04:41.847 1000 503 503 F : page_pinner info is not present (never set?) 05-20 20:04:41.847 1000 503 503 W page : 0000000099d95f64 refcount:1 mapcount:0 mapping:0000000000000000 index:0x72aa2d6 pfn:0x9e912d 05-20 20:04:41.847 1000 503 503 W anon flags: 0x8000000000080004(uptodate|swapbacked) 05-20 20:04:41.847 1000 503 503 W raw : 8000000000080004 ffffffff25844b08 ffffffff25844b88 ffffff89824e46c1 05-20 20:04:41.847 1000 503 503 W raw : 00000000072aa2d6 0000000000000000 00000001ffffffff 0000000000000000 05-20 20:04:41.847 1000 503 503 W : page dumped because: migration failure 05-20 20:04:41.847 1000 503 503 F : page_pinner info is not present (never set?) 05-20 20:04:41.847 1000 503 503 W page : 000000009af39924 refcount:1 mapcount:0 mapping:0000000000000000 index:0x72aa2d5 pfn:0x9e912c 05-20 20:04:41.847 1000 503 503 W anon flags: 0x8000000000080004(uptodate|swapbacked) 05-20 20:04:41.847 1000 503 503 W raw : 8000000000080004 ffffffff25844ac8 ffffffff25844b48 ffffff89824e46c1 05-20 20:04:41.847 1000 503 503 W raw : 00000000072aa2d5 0000000000000000 00000001ffffffff 0000000000000000 05-20 20:04:41.847 1000 503 503 W : page dumped because: migration failure .. .. It means those pages would be temporarily pinnned during migration so the migration failed but putback_movable_pages will end up freeing them since their page refcount are 1 now. Thus, it doesn't deserve to dump them for the debugging aid. Bug: 188908895 Signed-off-by: Minchan Kim Change-Id: I24092f0e53a3154443b9d6786413c4714ae853e8 --- mm/page_alloc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9b5ec5c9bc70..5976a2e6390e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8546,10 +8546,20 @@ static void alloc_contig_dump_pages(struct list_head *page_list) if (DYNAMIC_DEBUG_BRANCH(descriptor)) { struct page *page; + unsigned long nr_skip = 0; + unsigned long nr_pages = 0; dump_stack(); - list_for_each_entry(page, page_list, lru) + list_for_each_entry(page, page_list, lru) { + nr_pages++; + /* The page will be freed by putback_movable_pages soon */ + if (page_count(page) == 1) { + nr_skip++; + continue; + } dump_page(page, "migration failure"); + } + pr_warn("total dump_pages %u skipping %u\n", nr_pages, nr_skip); } } #else