From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E7FBC433B4 for ; Fri, 16 Apr 2021 23:16:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B4B1B610CD for ; Fri, 16 Apr 2021 23:16:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4B1B610CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 57EC76B0070; Fri, 16 Apr 2021 19:16:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 556116B0071; Fri, 16 Apr 2021 19:16:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F74E6B0072; Fri, 16 Apr 2021 19:16:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id 24C8E6B0070 for ; Fri, 16 Apr 2021 19:16:20 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CB6C81803007F for ; Fri, 16 Apr 2021 23:16:19 +0000 (UTC) X-FDA: 78039790878.08.B425289 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id BE660A0003A0 for ; Fri, 16 Apr 2021 23:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=9BjCjqxwi6v9E4F0a+hexiRxdGm8wFs5BMpe9gfpLdo=; b=KDSY/zHM2rL1TUO2qytXciC7AU DY4Q0GokdsNfZd7X77plmE4qroTZPAureCViYnCS+XXzOUlnSYa07aPteEEdboXwAXiJMj/Cq0Nar fnch8Aofgz5OH7zd1V1Qi4PJw9Yr8c40X/X3vXAYhDy0kePzRmYO00N5yB5POT6ujC0frUT61v6e2 W/AcN7iCeKpspfH6DguzVa83EGYRbGBlhui+gz+AW5TDGNGs7F7g5p0Jq62nFxjxAwVLi6kTZPLAY 1n4KoH4qNs6ndnpD9GvPQ9O1dBVcXEIULgsuFQ6alTSj+IIm5yOt0lwTBMDw3BgaemsaUZSDXtSVR NDbFgo1g==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lXXgs-00AZx2-1Y; Fri, 16 Apr 2021 23:16:01 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , Andrew Morton , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] mm/debug: Factor PagePoisoned out of __dump_page Date: Sat, 17 Apr 2021 00:15:27 +0100 Message-Id: <20210416231531.2521383-3-willy@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210416231531.2521383-1-willy@infradead.org> References: <20210416231531.2521383-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: BE660A0003A0 X-Stat-Signature: w7cdcpjbuu374a7e19ik71gynpq5tq9g Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf23; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618614977-623970 Content-Transfer-Encoding: quoted-printable 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: Move the PagePoisoned test into dump_page(). Skip the hex print for poisoned pages -- we know they're full of ffffffff. Move the reason printing from __dump_page() to dump_page(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/debug.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/mm/debug.c b/mm/debug.c index 84cdcd0f7bd3..e73fe0a8ec3d 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -42,11 +42,10 @@ const struct trace_print_flags vmaflag_names[] =3D { {0, NULL} }; =20 -static void __dump_page(struct page *page, const char *reason) +static void __dump_page(struct page *page) { struct page *head =3D compound_head(page); struct address_space *mapping; - bool page_poisoned =3D PagePoisoned(page); bool compound =3D PageCompound(page); /* * Accessing the pageblock without the zone lock. It could change to @@ -58,16 +57,6 @@ static void __dump_page(struct page *page, const char = *reason) int mapcount; char *type =3D ""; =20 - /* - * If struct page is poisoned don't access Page*() functions as that - * leads to recursive loop. Page*() check for poisoned pages, and calls - * dump_page() when detected. - */ - if (page_poisoned) { - pr_warn("page:%px is uninitialized and poisoned", page); - goto hex_only; - } - if (page < head || (page >=3D head + MAX_ORDER_NR_PAGES)) { /* * Corrupt page, so we cannot call page_mapping. Instead, do a @@ -173,8 +162,6 @@ static void __dump_page(struct page *page, const char= *reason) =20 pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags, page_cma ? " CMA" : ""); - -hex_only: print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, sizeof(unsigned long), page, sizeof(struct page), false); @@ -182,14 +169,16 @@ static void __dump_page(struct page *page, const ch= ar *reason) print_hex_dump(KERN_WARNING, "head: ", DUMP_PREFIX_NONE, 32, sizeof(unsigned long), head, sizeof(struct page), false); - - if (reason) - pr_warn("page dumped because: %s\n", reason); } =20 void dump_page(struct page *page, const char *reason) { - __dump_page(page, reason); + if (PagePoisoned(page)) + pr_warn("page:%p is uninitialized and poisoned", page); + else + __dump_page(page); + if (reason) + pr_warn("page dumped because: %s\n", reason); dump_page_owner(page); } EXPORT_SYMBOL(dump_page); --=20 2.30.2