From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbcAGNKG (ORCPT ); Thu, 7 Jan 2016 08:10:06 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:36614 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbcAGNKE (ORCPT ); Thu, 7 Jan 2016 08:10:04 -0500 Date: Thu, 7 Jan 2016 14:10:00 +0100 From: Michal Hocko To: Vlastimil Babka Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Minchan Kim , Sasha Levin , "Kirill A. Shutemov" , Mel Gorman Subject: Re: [PATCH v3 14/14] mm, debug: move bad flags printing to bad_page() Message-ID: <20160107131000.GM27868@dhcp22.suse.cz> References: <1450429406-7081-1-git-send-email-vbabka@suse.cz> <1450429406-7081-15-git-send-email-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450429406-7081-15-git-send-email-vbabka@suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 18-12-15 10:03:26, Vlastimil Babka wrote: > Since bad_page() is the only user of the badflags parameter of > dump_page_badflags(), we can move the code to bad_page() and simplify a bit. > > The dump_page_badflags() function is renamed to __dump_page() and can still be > called separately from dump_page() for temporary debug prints where page_owner > info is not desired. > > The only user-visible change is that page->mem_cgroup is printed before the bad > flags. > > Signed-off-by: Vlastimil Babka > Cc: Joonsoo Kim > Cc: Minchan Kim > Cc: Sasha Levin > Cc: "Kirill A. Shutemov" > Cc: Mel Gorman > Cc: Michal Hocko Acked-by: Michal Hocko > --- > include/linux/mmdebug.h | 3 +-- > mm/debug.c | 10 +++------- > mm/page_alloc.c | 10 +++++++--- > 3 files changed, 11 insertions(+), 12 deletions(-) > > diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h > index 2c8286cf162e..9b0dc2161f7a 100644 > --- a/include/linux/mmdebug.h > +++ b/include/linux/mmdebug.h > @@ -14,8 +14,7 @@ extern const struct trace_print_flags vmaflag_names[]; > extern const struct trace_print_flags gfpflag_names[]; > > extern void dump_page(struct page *page, const char *reason); > -extern void dump_page_badflags(struct page *page, const char *reason, > - unsigned long badflags); > +extern void __dump_page(struct page *page, const char *reason); > void dump_vma(const struct vm_area_struct *vma); > void dump_mm(const struct mm_struct *mm); > > diff --git a/mm/debug.c b/mm/debug.c > index 7260644d8cc1..4c03b6d07c82 100644 > --- a/mm/debug.c > +++ b/mm/debug.c > @@ -40,8 +40,7 @@ const struct trace_print_flags vmaflag_names[] = { > {0, NULL} > }; > > -void dump_page_badflags(struct page *page, const char *reason, > - unsigned long badflags) > +void __dump_page(struct page *page, const char *reason) > { > pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx", > page, atomic_read(&page->_count), page_mapcount(page), > @@ -50,15 +49,12 @@ void dump_page_badflags(struct page *page, const char *reason, > pr_cont(" compound_mapcount: %d", compound_mapcount(page)); > pr_cont("\n"); > BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); > + > pr_emerg("flags: %#lx(%pgp)\n", page->flags, &page->flags); > > if (reason) > pr_alert("page dumped because: %s\n", reason); > > - badflags &= page->flags; > - if (badflags) > - pr_alert("bad because of flags: %#lx(%pgp)\n", badflags, > - &badflags); > #ifdef CONFIG_MEMCG > if (page->mem_cgroup) > pr_alert("page->mem_cgroup:%p\n", page->mem_cgroup); > @@ -67,7 +63,7 @@ void dump_page_badflags(struct page *page, const char *reason, > > void dump_page(struct page *page, const char *reason) > { > - dump_page_badflags(page, reason, 0); > + __dump_page(page, reason); > dump_page_owner(page); > } > EXPORT_SYMBOL(dump_page); > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 7718ee40726a..bac8842d4fcf 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -428,7 +428,7 @@ static void bad_page(struct page *page, const char *reason, > goto out; > } > if (nr_unshown) { > - printk(KERN_ALERT > + pr_alert( > "BUG: Bad page state: %lu messages suppressed\n", > nr_unshown); > nr_unshown = 0; > @@ -438,9 +438,13 @@ static void bad_page(struct page *page, const char *reason, > if (nr_shown++ == 0) > resume = jiffies + 60 * HZ; > > - printk(KERN_ALERT "BUG: Bad page state in process %s pfn:%05lx\n", > + pr_alert("BUG: Bad page state in process %s pfn:%05lx\n", > current->comm, page_to_pfn(page)); > - dump_page_badflags(page, reason, bad_flags); > + __dump_page(page, reason); > + bad_flags &= page->flags; > + if (bad_flags) > + pr_alert("bad because of flags: %#lx(%pgp)\n", > + bad_flags, &bad_flags); > dump_page_owner(page); > > print_modules(); > -- > 2.6.3 -- Michal Hocko SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by kanga.kvack.org (Postfix) with ESMTP id DBD71828DE for ; Thu, 7 Jan 2016 08:10:03 -0500 (EST) Received: by mail-wm0-f45.google.com with SMTP id f206so96621688wmf.0 for ; Thu, 07 Jan 2016 05:10:03 -0800 (PST) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com. [74.125.82.54]) by mx.google.com with ESMTPS id u75si19767916wmu.18.2016.01.07.05.10.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jan 2016 05:10:02 -0800 (PST) Received: by mail-wm0-f54.google.com with SMTP id f206so122553324wmf.0 for ; Thu, 07 Jan 2016 05:10:02 -0800 (PST) Date: Thu, 7 Jan 2016 14:10:00 +0100 From: Michal Hocko Subject: Re: [PATCH v3 14/14] mm, debug: move bad flags printing to bad_page() Message-ID: <20160107131000.GM27868@dhcp22.suse.cz> References: <1450429406-7081-1-git-send-email-vbabka@suse.cz> <1450429406-7081-15-git-send-email-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450429406-7081-15-git-send-email-vbabka@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: To: Vlastimil Babka Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Minchan Kim , Sasha Levin , "Kirill A. Shutemov" , Mel Gorman On Fri 18-12-15 10:03:26, Vlastimil Babka wrote: > Since bad_page() is the only user of the badflags parameter of > dump_page_badflags(), we can move the code to bad_page() and simplify a bit. > > The dump_page_badflags() function is renamed to __dump_page() and can still be > called separately from dump_page() for temporary debug prints where page_owner > info is not desired. > > The only user-visible change is that page->mem_cgroup is printed before the bad > flags. > > Signed-off-by: Vlastimil Babka > Cc: Joonsoo Kim > Cc: Minchan Kim > Cc: Sasha Levin > Cc: "Kirill A. Shutemov" > Cc: Mel Gorman > Cc: Michal Hocko Acked-by: Michal Hocko > --- > include/linux/mmdebug.h | 3 +-- > mm/debug.c | 10 +++------- > mm/page_alloc.c | 10 +++++++--- > 3 files changed, 11 insertions(+), 12 deletions(-) > > diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h > index 2c8286cf162e..9b0dc2161f7a 100644 > --- a/include/linux/mmdebug.h > +++ b/include/linux/mmdebug.h > @@ -14,8 +14,7 @@ extern const struct trace_print_flags vmaflag_names[]; > extern const struct trace_print_flags gfpflag_names[]; > > extern void dump_page(struct page *page, const char *reason); > -extern void dump_page_badflags(struct page *page, const char *reason, > - unsigned long badflags); > +extern void __dump_page(struct page *page, const char *reason); > void dump_vma(const struct vm_area_struct *vma); > void dump_mm(const struct mm_struct *mm); > > diff --git a/mm/debug.c b/mm/debug.c > index 7260644d8cc1..4c03b6d07c82 100644 > --- a/mm/debug.c > +++ b/mm/debug.c > @@ -40,8 +40,7 @@ const struct trace_print_flags vmaflag_names[] = { > {0, NULL} > }; > > -void dump_page_badflags(struct page *page, const char *reason, > - unsigned long badflags) > +void __dump_page(struct page *page, const char *reason) > { > pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx", > page, atomic_read(&page->_count), page_mapcount(page), > @@ -50,15 +49,12 @@ void dump_page_badflags(struct page *page, const char *reason, > pr_cont(" compound_mapcount: %d", compound_mapcount(page)); > pr_cont("\n"); > BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); > + > pr_emerg("flags: %#lx(%pgp)\n", page->flags, &page->flags); > > if (reason) > pr_alert("page dumped because: %s\n", reason); > > - badflags &= page->flags; > - if (badflags) > - pr_alert("bad because of flags: %#lx(%pgp)\n", badflags, > - &badflags); > #ifdef CONFIG_MEMCG > if (page->mem_cgroup) > pr_alert("page->mem_cgroup:%p\n", page->mem_cgroup); > @@ -67,7 +63,7 @@ void dump_page_badflags(struct page *page, const char *reason, > > void dump_page(struct page *page, const char *reason) > { > - dump_page_badflags(page, reason, 0); > + __dump_page(page, reason); > dump_page_owner(page); > } > EXPORT_SYMBOL(dump_page); > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 7718ee40726a..bac8842d4fcf 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -428,7 +428,7 @@ static void bad_page(struct page *page, const char *reason, > goto out; > } > if (nr_unshown) { > - printk(KERN_ALERT > + pr_alert( > "BUG: Bad page state: %lu messages suppressed\n", > nr_unshown); > nr_unshown = 0; > @@ -438,9 +438,13 @@ static void bad_page(struct page *page, const char *reason, > if (nr_shown++ == 0) > resume = jiffies + 60 * HZ; > > - printk(KERN_ALERT "BUG: Bad page state in process %s pfn:%05lx\n", > + pr_alert("BUG: Bad page state in process %s pfn:%05lx\n", > current->comm, page_to_pfn(page)); > - dump_page_badflags(page, reason, bad_flags); > + __dump_page(page, reason); > + bad_flags &= page->flags; > + if (bad_flags) > + pr_alert("bad because of flags: %#lx(%pgp)\n", > + bad_flags, &bad_flags); > dump_page_owner(page); > > print_modules(); > -- > 2.6.3 -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org