Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2100310ybl; Sun, 19 Jan 2020 19:05:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwZuObSyMXMHrvogm3FOYaUaXoEJEa8hRyNAGQMDxX3VQhyDQkelL18mkr0+dugUuOq/ECY X-Received: by 2002:a05:6830:1d5b:: with SMTP id p27mr13828652oth.263.1579489531190; Sun, 19 Jan 2020 19:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579489531; cv=none; d=google.com; s=arc-20160816; b=ac9P+hBF2SqX410119Q8ixjP5wZR7lBy1K8UODtvYPPHGBtytI8OvcpSP+ndS9KRtX rCb/irP/4qFfp3kBPs8PMFWFjYxCPDxlt7kCKX2cT/tsA2e3LicvW7anZDtwadFO2dJO fZLtEgxFS7x7QEohMe0sq9YglRzyV+OeGTjyhjLPgmznEc6H/GqiRYGd1yG7SzAFPPwZ 74rAQtB8+dfGg/9gN82MUSeHIXt9dFguMPJUh1cnWzYo54qCIAHFkcJn7DyiUnaitJCX Ldjuj5iBqIyltxq9Y/eDXfC32BYEFxf3mxBTZKXHnuE9zPRPKWjpr7rnDUXBCTBDYbmm WJLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=jilIjETjNHtcD6OlceL2WHcUw0nL0MX9wSI/1ctLeus=; b=rmVapvLkS+LZB+W2bZ6fakjKNuu8M0TH+mH4Mnz0ncpI4egPKH/AfceaXTzqtXclVk QbHOI5ObXquiPrz355QdvVY5PeIMxaRrBpn1Y0aX3wdNKjB09y5r9GgWXvoIEBKbdHiE z82yqvFJ4SISrQJX+UPQuqbrj40QjM1SDu89h/2tNpaBKNQYB34yV8ribFYVuR6hOd+q 7/hk78cRpU5AW7N9tKIxJBPFS9QlbtX3BfMY9D+LcECDkZtcbeGnVCr7W6FuKU7x5dd/ eI4X5Mp90yjz1Whv0m3vrqIyfbMX6jeBgHWzi+XtzmVWB3jyPIlXLlhcBTEM4BCwDGWg 94BA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si19073659otk.251.2020.01.19.19.05.19; Sun, 19 Jan 2020 19:05:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729122AbgATDEZ (ORCPT + 99 others); Sun, 19 Jan 2020 22:04:25 -0500 Received: from mga04.intel.com ([192.55.52.120]:51507 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728949AbgATDEY (ORCPT ); Sun, 19 Jan 2020 22:04:24 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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", -- 2.17.1