On Fri, May 28, 2021 at 11:26 AM John Hubbard <jhubbard@xxxxxxxxxx> wrote:
On 5/28/21 10:54 AM, 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.
If the mapcount calculation were in a separate routine, *and* if something
else in addition to dump_page() used it, then I'd be interested in
calling it from dump_page().
There is. The total_mapcount() is used by mm code. But as I mentioned
in the commit log and that discussion email, it is not safe to call it
directly in dump_page() path.