From: Hugh Dickins <hughd@google.com>
To: Yang Shi <shy828301@gmail.com>
Cc: hughd@google.com, willy@infradead.org, jhubbard@nvidia.com,
kirill.shutemov@linux.intel.com, vbabka@suse.cz,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mm: dump_page: print total mapcount for compound page
Date: Fri, 28 May 2021 12:47:31 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.11.2105281222500.22433@eggly.anvils> (raw)
In-Reply-To: <20210528175403.4506-1-shy828301@gmail.com>
On Fri, 28 May 2021, Yang Shi wrote:
> The total mapcount is a useful information for debugging, but we can't
> call total_mapcount() directly since it calls some assertions which may
> be triggered as commit 6dc5ea16c86f ("mm,
> dump_page: do not crash with bad compound_mapcount()") met.
>
> We could implement yet another implementation for dump_page() but
> it has the limitation when individual mapcount of subpages is corrupted.
>
> Actually the total mapcount could be decoded from refcount, pincount and
> compound mapcount although it may be not very precise due to some
> transient references.
>
> Signed-off-by: Yang Shi <shy828301@gmail.com>
> ---
> I think we are on the same page that the total mapcount is useful
Well, it may be useful (and used to be shown) in the case we've been
thinking of; but there the critical fact, page_mapped(), is evident from
the fact that your VM_WARN_ON_ONCE_PAGE(page_mapped) is shown at all:
being a number, total_mapcount() tells a little more, but not a lot.
> information and it would be ideal to print this information when dumpping
Yes, I admit I did say "ideal": but not at this cost.
I'm sorry for pointing you down (something like) this path.
If total_mapcount() itself had been assuredly safe, it would
have been nice to add in; but not this substitute.
> page if possible. But how to implement it safely seems controversial.
> Some ideas and potential problems have been discussed by
> https://lore.kernel.org/linux-mm/alpine.LSU.2.11.2105261733110.16920@eggly.anvils/.
>
> So I prepared this patch to show a possible approach to get some
> feedback. The same thing could be decoded by the reader of page dump
> as well by using the same formula used by this patch. However it sounds
> more convenient to have kernel do the math.
>
> mm/debug.c | 35 +++++++++++++++++++++++++++++------
> 1 file changed, 29 insertions(+), 6 deletions(-)
Adding that code to come up with a deceptive approximation to a number
which most sites won't care about: speaking for me, I'll say no.
Hugh
next prev parent reply other threads:[~2021-05-28 19:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-28 17:54 [RFC PATCH] mm: dump_page: print total mapcount for compound page Yang Shi
2021-05-28 18:22 ` Matthew Wilcox
2021-05-28 18:56 ` Yang Shi
2021-05-28 18:26 ` John Hubbard
2021-05-28 19:03 ` Yang Shi
2021-05-28 19:59 ` John Hubbard
2021-05-28 19:47 ` Hugh Dickins [this message]
2021-05-31 8:19 ` Kirill A. Shutemov
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=alpine.LSU.2.11.2105281222500.22433@eggly.anvils \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).