Re: [RFC PATCH] mm: dump_page: print total mapcount for compound page
From: John Hubbard <jhubbard@nvidia.com>
Date: 2021-05-28 19:59:39
Also in:
lkml
On 5/28/21 12:03 PM, Yang Shi wrote:
On Fri, May 28, 2021 at 11:26 AM John Hubbard [off-list ref] wrote:quoted
On 5/28/21 10:54 AM, Yang Shi wrote:quoted
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.
Right! I apologize for missing the point that it is a separate function. But unfortunately, the conclusion here is still the same, if you are unable to actually call that function. Basically, if you can make simple calls to retrieve and print out information, then that's a good situation for diagnostics routines such as dump_page(). But if you have to open-code calculations and those start to get complex, then you have probably gone off in the wrong direction. Keep in mind that the diag routines themselves have to be correct, and they usually don't have the same level of testing that other routines do. thanks, -- John Hubbard NVIDIA