From patchwork Mon Jan 20 03:04:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11340931 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC26B921 for ; Mon, 20 Jan 2020 03:04:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7A6F120730 for ; Mon, 20 Jan 2020 03:04:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A6F120730 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 604A26B059B; Sun, 19 Jan 2020 22:04:27 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 58F856B059C; Sun, 19 Jan 2020 22:04:27 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 430BC6B059D; Sun, 19 Jan 2020 22:04:27 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id 2D69B6B059B for ; Sun, 19 Jan 2020 22:04:27 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id A701C181AC9CC for ; Mon, 20 Jan 2020 03:04:26 +0000 (UTC) X-FDA: 76396519332.27.rings12_43d453fb70e47 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,richardw.yang@linux.intel.com,:akpm@linux-foundation.org:richardw.yang@linux.intel.com:linux-kernel@vger.kernel.org::rientjes@google.com,RULES_HIT:30045:30054:30056:30070,0,RBL:192.55.52.93:@linux.intel.com:.lbl8.mailshell.net-62.18.0.100 64.95.201.95,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:33,LUA_SUMMARY:none X-HE-Tag: rings12_43d453fb70e47 X-Filterd-Recvd-Size: 3690 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jan 2020 03:04:25 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jan 2020 19:04:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,340,1574150400"; d="scan'208";a="306802495" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga001.jf.intel.com with ESMTP; 19 Jan 2020 19:04:22 -0800 From: Wei Yang To: akpm@linux-foundation.org, richardw.yang@linux.intel.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, rientjes@google.com Subject: [Patch v2 1/4] mm: enable dump several reasons for __dump_page() Date: Mon, 20 Jan 2020 11:04:12 +0800 Message-Id: <20200120030415.15925-2-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200120030415.15925-1-richardw.yang@linux.intel.com> References: <20200120030415.15925-1-richardw.yang@linux.intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is a preparation to dump all reasons during check page. Signed-off-by: Wei Yang --- include/linux/mmdebug.h | 2 +- mm/debug.c | 11 ++++++----- mm/page_alloc.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 2ad72d2c8cc5..f0a612db8bae 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -10,7 +10,7 @@ struct vm_area_struct; struct mm_struct; extern void dump_page(struct page *page, const char *reason); -extern void __dump_page(struct page *page, const char *reason); +extern void __dump_page(struct page *page, int num, 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 0461df1207cb..a8ac6f951f9f 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -42,11 +42,11 @@ const struct trace_print_flags vmaflag_names[] = { {0, NULL} }; -void __dump_page(struct page *page, const char *reason) +void __dump_page(struct page *page, int num, const char **reason) { struct address_space *mapping; bool page_poisoned = PagePoisoned(page); - int mapcount; + int mapcount, i; /* * If struct page is poisoned don't access Page*() functions as that @@ -97,8 +97,9 @@ void __dump_page(struct page *page, const char *reason) sizeof(unsigned long), page, sizeof(struct page), false); - if (reason) - pr_warn("page dumped because: %s\n", reason); + pr_warn("page dumped because:\n"); + for (i = 0; i < num; i++) + pr_warn("\t%s\n", reason[i]); #ifdef CONFIG_MEMCG if (!page_poisoned && page->mem_cgroup) @@ -108,7 +109,7 @@ void __dump_page(struct page *page, const char *reason) void dump_page(struct page *page, const char *reason) { - __dump_page(page, reason); + __dump_page(page, 1, &reason); dump_page_owner(page); } EXPORT_SYMBOL(dump_page); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d047bf7d8fd4..0cf6218aaba7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -638,7 +638,7 @@ static void bad_page(struct page *page, const char *reason, pr_alert("BUG: Bad page state in process %s pfn:%05lx\n", current->comm, page_to_pfn(page)); - __dump_page(page, reason); + __dump_page(page, 1, &reason); bad_flags &= page->flags; if (bad_flags) pr_alert("bad because of flags: %#lx(%pGp)\n",