From: John Hubbard <jhubbard@nvidia.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>,
Matthew Wilcox <willy@infradead.org>
Cc: <linux-mm@kvack.org>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH] mm: Improve dump_page() for compound pages
Date: Mon, 10 Feb 2020 11:50:21 -0800 [thread overview]
Message-ID: <92d69132-6664-3fc3-4743-11109df0b079@nvidia.com> (raw)
In-Reply-To: <20200210124225.56cjwblfa7njgp5o@box>
On 2/10/20 4:42 AM, Kirill A. Shutemov wrote:
...
>> @@ -66,25 +68,32 @@ void __dump_page(struct page *page, const char *reason)
>> goto hex_only;
>> }
>>
>> - mapping = page_mapping(page);
>> + if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) {
>> + /* Corrupt page, cannot call page_mapping */
>> + mapping = page->mapping;
>> + head = page;
>> + compound = false;
>> + } else {
>> + mapping = page_mapping(page);
>> + }
>>
>> /*
>> * Avoid VM_BUG_ON() in page_mapcount().
>> * page->_mapcount space in struct page is used by sl[aou]b pages to
>> * encode own info.
>> */
>> - mapcount = PageSlab(page) ? 0 : page_mapcount(page);
>> + mapcount = PageSlab(head) ? 0 : page_mapcount(head);
>
> This is wrong. We want to see mapcount for the tail page, not head.
>
I see what you mean: page_mapcount(page) sums up both the page's and the
head page's mapcount in some cases. The function doesn't seem to work
correctly unless it is fed the tail page.
Here, even though the "head" variable's meaning is overloaded (=="head page,
unless the tail page was corrupted, in which case, tail page"), it would still be
accurate to change that line back to the original line, so that it once again
reads:
mapcount = PageSlab(page) ? 0 : page_mapcount(page);
Matthew?
(Also, I see that __page_mapcount is EXPORT-ed, which is odd: nothing uses it
other than page_mapcount. Micro-housecleaning time maybe...)
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2020-02-10 19:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-08 4:44 Matthew Wilcox
2020-02-08 4:48 ` Matthew Wilcox
2020-02-09 1:09 ` John Hubbard
2020-02-09 1:12 ` Matthew Wilcox
2020-02-09 1:18 ` John Hubbard
2020-02-10 12:42 ` Kirill A. Shutemov
2020-02-10 19:50 ` John Hubbard [this message]
2020-02-10 21:21 ` Kirill A. Shutemov
2020-02-10 21:33 ` John Hubbard
2020-02-10 21:54 ` Kirill A. Shutemov
2020-02-10 22:00 ` John Hubbard
2020-02-10 22:02 ` Matthew Wilcox
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=92d69132-6664-3fc3-4743-11109df0b079@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-mm@kvack.org \
--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