From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org
Subject: Re: [PATCH] mm: avoid endless recursion in dump_page()
Date: Thu, 22 Sep 2016 13:55:32 +0300 [thread overview]
Message-ID: <20160922105532.GB24593@node> (raw)
In-Reply-To: <df20f638-0c22-36fd-24b1-3e748419a23c@suse.cz>
On Wed, Sep 21, 2016 at 04:27:31PM +0200, Vlastimil Babka wrote:
> On 09/08/2016 10:21 AM, Kirill A. Shutemov wrote:
> >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().
>
> How about instead splitting page_mapcount() so that there is a version
> without VM_BUG_ON_PAGE()?
Why? page->_mapping is garbage for slab page and might be confusing.
If you want the information from page->_mapping union for slab page to be
shown during dump_page() we should present in proper way.
>
> >Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> >---
> > mm/debug.c | 6 ++++--
> > 1 file 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[] = {
> >
> > void __dump_page(struct page *page, const char *reason)
> > {
>
> At least there should be a comment explaining why.
Fair enough.
> >+ int mapcount = PageSlab(page) ? 0 : page_mapcount(page);
next prev parent reply other threads:[~2016-09-22 10:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 8:21 Kirill A. Shutemov
2016-09-21 14:27 ` Vlastimil Babka
2016-09-22 10:55 ` Kirill A. Shutemov [this message]
2016-09-22 11:26 ` Vlastimil Babka
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=20160922105532.GB24593@node \
--to=kirill@shutemov.name \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/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