From: John Hubbard <jhubbard@nvidia.com>
To: Matthew Wilcox <willy@infradead.org>, Vlastimil Babka <vbabka@suse.cz>
Cc: <linux-mm@kvack.org>, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/3] mm: Print head flags in dump_page
Date: Tue, 30 Jun 2020 19:12:02 -0700 [thread overview]
Message-ID: <3c0af8cd-98bd-4690-fffb-69f7e0a2dc58@nvidia.com> (raw)
In-Reply-To: <20200630115950.GM25523@casper.infradead.org>
On 2020-06-30 04:59, Matthew Wilcox wrote:
...
> How about ...
> [ 38.049155] flags: 0x17ffe000000000e(anon|referenced|uptodate|dirty|compound)
>
> That is, change pageflag_names[] to print 'head' as 'compound' and move the
> 'anon' or 'ksm' to look like a pageflag. Also CMA. Like this:
>
> +++ b/include/trace/events/mmflags.h
> @@ -96,7 +96,7 @@
> {1UL << PG_private, "private" }, \
> {1UL << PG_private_2, "private_2" }, \
> {1UL << PG_writeback, "writeback" }, \
> - {1UL << PG_head, "head" }, \
> + {1UL << PG_head, "compound" }, \
> {1UL << PG_mappedtodisk, "mappedtodisk" }, \
> {1UL << PG_reclaim, "reclaim" }, \
> {1UL << PG_swapbacked, "swapbacked" }, \
> +++ b/mm/debug.c
> @@ -54,7 +54,7 @@ void __dump_page(struct page *page, const char *reason)
> * state for debugging, it should be fine to accept a bit of
> * inaccuracy here due to racing.
> */
> - bool page_cma = is_migrate_cma_page(page);
> + char *cma = is_migrate_cma_page(page) ? "|cma" : "";
> int mapcount;
> char *type = "";
>
> @@ -71,6 +71,10 @@ void __dump_page(struct page *page, const char *reason)
> if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) {
> /* Corrupt page, cannot call page_mapping */
> mapping = page->mapping;
> + if ((unsigned long)mapping & PAGE_MAPPING_ANON)
> + mapping = NULL;
> + mapping = (struct address_space *)
> + ((unsigned long)mapping & ~PAGE_MAPPING_FLAGS);
> head = page;
> compound = false;
> } else {
> [...]
> if (PageKsm(page))
> - type = "ksm ";
> + type = "ksm|";
> else if (PageAnon(page))
> - type = "anon ";
> - else if (mapping) {
> + type = "anon|";
> +
> + BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
> + pr_warn("flags: %#lx(%s%pGp%s)\n", page->flags, type, &page->flags,
> + cma);
> +
> + if (mapping) {
> const struct inode *host;
> const struct address_space_operations *a_ops;
> @@ -163,11 +167,6 @@ void __dump_page(struct page *page, const char *reason)
> }
> }
> out_mapping:
> - BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
> -
> - pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags,
> - page_cma ? " CMA" : "");
> -
> hex_only:
> print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
> sizeof(unsigned long), page,
>
> Can also delete the 'out_mapping' label this way.
OK, so after applying that on top of your original series, and your
line-break approach, here's what the output looks like for regular
and THP, head and tail pages (all involving FOLL_PIN):
THP FOLL_PIN page: head page:
[ 42.360473] page:0000000025f35fdb refcount:513 mapcount:1 mapping:0000000000000000 index:0x0
[ 42.368012] head:0000000025f35fdb order:9 compound_mapcount:1 compound_pincount:512
[ 42.374761] flags: 0x17ffe000001000e(anon|referenced|uptodate|dirty|compound)
[ 42.380994] raw: 017ffe000001000e ffffffff83649ca0 ffffea0020c80008 ffff888898091901
[ 42.387822] raw: 0000000000000000 0000000000000000 00000201ffffffff 0000000000000000
[ 42.394680] page dumped because: gup_benchmark: head page: dump_page test
THP FOLL_PIN page: tail page:
[ 42.408222] page:00000000803d233b refcount:513 mapcount:1 mapping:0000000000000000 index:0x11
[ 42.415850] head:0000000025f35fdb order:9 compound_mapcount:1 compound_pincount:512
[ 42.422607] flags: 0x17ffe0000000000(anon|)
[ 42.425772] raw: 017ffe0000000000 ffffea0020c98001 ffffea0020c98448 dead000000000400
[ 42.432636] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[ 42.439490] head: 017ffe000001000e ffffffff83649ca0 ffffea0020c80008 ffff888898091901
[ 42.446431] head: 0000000000000000 0000000000000000 00000201ffffffff 0000000000000000
[ 42.453355] page dumped because: gup_benchmark: tail page: dump_page test
Non-THP FOLL_PIN page: head page:
[ 41.513677] page:00000000190e28ba refcount:1025 mapcount:1 mapping:0000000000000000 index:0x0
[ 41.521331] flags: 0x17ffe0000080034(anon|uptodate|lru|active|swapbacked)
[ 41.527189] raw: 017ffe0000080034 ffffea002228db08 ffffea0022215108 ffff888898090191
[ 41.534020] raw: 0000000000000000 0000000000000000 0000040100000000 0000000000000000
[ 41.540863] page dumped because: gup_benchmark: head page: dump_page test
Non-THP FOLL_PIN page: tail page:
[ 41.554472] page:00000000696a8210 refcount:1025 mapcount:1 mapping:0000000000000000 index:0x11
[ 41.562230] flags: 0x17ffe0000080034(anon|uptodate|lru|active|swapbacked)
[ 41.568073] raw: 017ffe0000080034 ffffea0022195688 ffffea0021a4e608 ffff888898090191
[ 41.574940] raw: 0000000000000011 0000000000000000 0000040100000000 0000000000000000
[ 41.581768] page dumped because: gup_benchmark: tail page: dump_page test
>
> (I really like it that we're debating this ... it feels like we've been
> in a bit of a push-pull with the debug patches over the years)
>
Yes, it's good that we're pausing a moment to polish this up. Lots of goodness
here and I like the above output.
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2020-07-01 2:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 15:19 [PATCH 0/3] Improvements for dump_page() Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 1/3] mm: Print head flags in dump_page Matthew Wilcox (Oracle)
2020-06-29 22:38 ` John Hubbard
2020-06-29 22:51 ` Matthew Wilcox
2020-06-29 22:54 ` John Hubbard
2020-06-29 23:35 ` John Hubbard
2020-06-30 8:02 ` Vlastimil Babka
2020-06-30 11:59 ` Matthew Wilcox
2020-07-01 2:12 ` John Hubbard [this message]
2020-07-02 14:59 ` Vlastimil Babka
2020-07-02 15:53 ` Kirill A. Shutemov
2020-07-02 16:19 ` Vlastimil Babka
2020-07-02 20:39 ` Kirill A. Shutemov
2020-07-02 21:01 ` Matthew Wilcox
2020-06-29 15:19 ` [PATCH 2/3] mm: Print the inode number " Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 3/3] mm: Print hashed address of struct page Matthew Wilcox (Oracle)
2020-07-02 15:56 ` Kirill A. Shutemov
2020-06-29 16:57 ` [PATCH 0/3] Improvements for dump_page() William Kucharski
2020-06-29 20:17 ` Mike Rapoport
2020-06-29 21:55 ` John Hubbard
2020-06-29 22:35 ` Matthew Wilcox
2020-06-29 23:41 ` John Hubbard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c0af8cd-98bd-4690-fffb-69f7e0a2dc58@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox