public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	John Dias <joaodias@google.com>,
	David Hildenbrand <david@redhat.com>,
	Jason Baron <jbaron@akamai.com>
Subject: Re: [PATCH v2] mm: page_alloc: dump migrate-failed pages
Date: Wed, 10 Mar 2021 10:07:25 -0800	[thread overview]
Message-ID: <YEkK3SktwS46Fp9o@google.com> (raw)
In-Reply-To: <YEj8qACYFmbckWk7@google.com>

On Wed, Mar 10, 2021 at 09:06:48AM -0800, Minchan Kim wrote:
> On Wed, Mar 10, 2021 at 05:46:56PM +0100, Michal Hocko wrote:
> > On Wed 10-03-21 08:05:36, Minchan Kim wrote:
> > > On Wed, Mar 10, 2021 at 02:07:05PM +0100, Michal Hocko wrote:
> > [...]
> > > > The is a lot of churn indeed. Have you considered adding $FOO_lglvl
> > > > variants for those so that you can use them for your particular case
> > > > without affecting most of existing users? Something similar we have
> > > > discussed in other email thread regarding lru_add_drain_all?
> > > 
> > > I thought that way but didn't try since it couldn't make them
> > > atomic(For example, other printk place in other context will
> > > affect by the $FOO_lglvl).
> > 
> > I do not follow. I meant something like the following (likely incomplete
> > but you should get an idea).
> 
> Oh, I thought you wanted to override loglevel temporally.
> 
> old_lvl = save_printk_lvl(new level);
> dump_page();
> restore_printk_lvl(old_lvl);
> 
> > 
> > diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h
> > index 3468794f83d2..71b402eb8f78 100644
> > --- a/include/linux/page_owner.h
> > +++ b/include/linux/page_owner.h
> > @@ -14,7 +14,7 @@ extern void __set_page_owner(struct page *page,
> >  extern void __split_page_owner(struct page *page, unsigned int nr);
> >  extern void __copy_page_owner(struct page *oldpage, struct page *newpage);
> >  extern void __set_page_owner_migrate_reason(struct page *page, int reason);
> > -extern void __dump_page_owner(struct page *page);
> > +extern void __dump_page_owner(struct page *page, const char *loglvl);
> >  extern void pagetypeinfo_showmixedcount_print(struct seq_file *m,
> >  					pg_data_t *pgdat, struct zone *zone);
> >  
> > @@ -46,10 +46,10 @@ static inline void set_page_owner_migrate_reason(struct page *page, int reason)
> >  	if (static_branch_unlikely(&page_owner_inited))
> >  		__set_page_owner_migrate_reason(page, reason);
> >  }
> > -static inline void dump_page_owner(struct page *page)
> > +static inline void dump_page_owner(struct page *page, const char *loglvl)
> >  {
> >  	if (static_branch_unlikely(&page_owner_inited))
> > -		__dump_page_owner(page);
> > +		__dump_page_owner(page, loglvl);
> >  }
> >  #else
> >  static inline void reset_page_owner(struct page *page, unsigned int order)
> > @@ -69,7 +69,7 @@ static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
> >  static inline void set_page_owner_migrate_reason(struct page *page, int reason)
> >  {
> >  }
> > -static inline void dump_page_owner(struct page *page)
> > +static inline void dump_page_owner(struct page *page, const char *loglvl)
> >  {
> >  }
> >  #endif /* CONFIG_PAGE_OWNER */
> > diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
> > index 9f8117c7cfdd..1b13135d9916 100644
> > --- a/kernel/stacktrace.c
> > +++ b/kernel/stacktrace.c
> > @@ -14,6 +14,18 @@
> >  #include <linux/kallsyms.h>
> >  #include <linux/stacktrace.h>
> >  
> > +void __stack_trace_print(const unsigned long *entries, unsigned int nr_entries,
> > +		       int spacesconst, char *loglvl)
> > +{
> > +	unsigned int i;
> > +
> > +	if (WARN_ON(!entries))
> > +		return;
> > +
> > +	for (i = 0; i < nr_entries; i++)
> > +		printk("%s%*c%pS\n", loglvl, 1 + spaces, ' ', (void *)entries[i]);
> > +}
> 
> That's exactly I did with introducing pr_loglevel. I wanted to address
> *all places* to use dump_page and stack_trace_print since some folks
> might ask me to fix all the broken place all at once. I'm getting tired
> with such hassle.
> 
> void dump_page(const char *log_lvl, struct page *page, const char *reason)
> {
>         __dump_page(log_lvl, page, reason);
>         dump_page_owner(log_lvl, page);
> }
> EXPORT_SYMBOL(dump_page);

Since it's good to have regardless of the patch, I posted next revision
with removeing ratelimit and put something more in description to
proceed the work.

Posted v3 - https://lore.kernel.org/linux-mm/20210310180104.517886-1-minchan@kernel.org/



  reply	other threads:[~2021-03-10 18:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 20:20 [PATCH v2] mm: page_alloc: dump migrate-failed pages Minchan Kim
2021-03-08 21:29 ` kernel test robot
2021-03-08 22:29   ` Minchan Kim
2021-03-09  0:41     ` [kbuild-all] " Rong Chen
2021-03-09  2:23       ` Minchan Kim
2021-03-09  0:21 ` Andrew Morton
2021-03-09  2:21   ` Minchan Kim
2021-03-09  0:30 ` kernel test robot
2021-03-09  0:30 ` [RFC PATCH] mm: page_alloc: alloc_contig_ratelimit() can be static kernel test robot
2021-03-09  9:32 ` [PATCH v2] mm: page_alloc: dump migrate-failed pages Michal Hocko
2021-03-09 16:15   ` Minchan Kim
2021-03-09 16:32     ` Michal Hocko
2021-03-09 17:27       ` Minchan Kim
2021-03-10 13:04         ` Michal Hocko
2021-03-10 15:59           ` Minchan Kim
2021-03-10  7:42     ` Minchan Kim
2021-03-10  8:20       ` David Hildenbrand
2021-03-10 15:45         ` Minchan Kim
2021-03-10 13:07       ` Michal Hocko
2021-03-10 16:05         ` Minchan Kim
2021-03-10 16:46           ` Michal Hocko
2021-03-10 17:06             ` Minchan Kim
2021-03-10 18:07               ` Minchan Kim [this message]
2021-03-10 13:26   ` Matthew Wilcox
2021-03-10 13:54     ` Michal Hocko

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=YEkK3SktwS46Fp9o@google.com \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jbaron@akamai.com \
    --cc=joaodias@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    /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