[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181123160404.259413e56a8cc9a22112712a@linux-foundation.org>
Date: Fri, 23 Nov 2018 16:04:04 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Michal Hocko <mhocko@...nel.org>
Cc: <linux-mm@...ck.org>, Oscar Salvador <OSalvador@...e.com>,
Baoquan He <bhe@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Michal Hocko <mhocko@...e.com>
Subject: Re: [RFC PATCH 1/5] mm: print more information about mapping in
__dump_page
On Wed, 7 Nov 2018 11:18:26 +0100 Michal Hocko <mhocko@...nel.org> wrote:
> From: Michal Hocko <mhocko@...e.com>
>
> __dump_page prints the mapping pointer but that is quite unhelpful
> for many reports because the pointer itself only helps to distinguish
> anon/ksm mappings from other ones (because of lowest bits
> set). Sometimes it would be much more helpful to know what kind of
> mapping that is actually and if we know this is a file mapping then also
> try to resolve the dentry name.
>
> ...
>
> --- a/mm/debug.c
> +++ b/mm/debug.c
>
> ...
>
> @@ -70,6 +71,18 @@ void __dump_page(struct page *page, const char *reason)
> if (PageCompound(page))
> pr_cont(" compound_mapcount: %d", compound_mapcount(page));
> pr_cont("\n");
> + if (PageAnon(page))
> + pr_emerg("anon ");
> + else if (PageKsm(page))
> + pr_emerg("ksm ");
> + else if (mapping) {
> + pr_emerg("%ps ", mapping->a_ops);
> + if (mapping->host->i_dentry.first) {
> + struct dentry *dentry;
> + dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);
> + pr_emerg("name:\"%*s\" ", dentry->d_name.len, dentry->d_name.name);
> + }
> + }
There has to be a better way of printing the filename. It is so often
needed.
The (poorly named and gleefully undocumented)
take_dentry_name_snapshot() looks promising. However it's unclear that
__dump_page() is always called from contexts where
take_dentry_name_snapshot() and release_dentry_name_snapshot() can be
safely called. Probably it's OK, but how to guarantee it?
Powered by blists - more mailing lists