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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 BB625C433B4 for ; Wed, 12 May 2021 03:29:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2ECC1613C8 for ; Wed, 12 May 2021 03:29:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2ECC1613C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AF59E6B0036; Tue, 11 May 2021 23:29:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA6016B006E; Tue, 11 May 2021 23:29:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91EF66B0070; Tue, 11 May 2021 23:29:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 735E46B0036 for ; Tue, 11 May 2021 23:29:14 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2E4A44DA9 for ; Wed, 12 May 2021 03:29:14 +0000 (UTC) X-FDA: 78131148228.12.798105F Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf17.hostedemail.com (Postfix) with ESMTP id 754B740002FE for ; Wed, 12 May 2021 03:29:07 +0000 (UTC) Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Fg0YR1p0YzQkTx; Wed, 12 May 2021 11:25:47 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Wed, 12 May 2021 11:29:06 +0800 Subject: Re: [PATCH 3/8] mm/debug: Factor PagePoisoned out of __dump_page To: "Matthew Wilcox (Oracle)" , , , CC: William Kucharski , Vlastimil Babka , Anshuman Khandual References: <20210430145549.2662354-1-willy@infradead.org> <20210430145549.2662354-4-willy@infradead.org> From: Kefeng Wang Message-ID: <2baf684e-f35d-5c42-fa11-1e061a12a81f@huawei.com> Date: Wed, 12 May 2021 11:29:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20210430145549.2662354-4-willy@infradead.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-CFilter-Loop: Reflected Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-Stat-Signature: sm7eh8y87awgjit57nzskgf1kccrshak X-Rspamd-Queue-Id: 754B740002FE X-Rspamd-Server: rspam02 Received-SPF: none (huawei.com>: No applicable sender policy available) receiver=imf17; identity=mailfrom; envelope-from=""; helo=szxga05-in.huawei.com; client-ip=45.249.212.191 X-HE-DKIM-Result: none/none X-HE-Tag: 1620790147-57583 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: On 2021/4/30 22:55, Matthew Wilcox (Oracle) wrote: > 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) > Reviewed-by: William Kucharski > Reviewed-by: Vlastimil Babka > Reviewed-by: Anshuman Khandual > --- > 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[] = { > {0, NULL} > }; > > -static void __dump_page(struct page *page, const char *reason) > +static void __dump_page(struct page *page) > { > struct page *head = compound_head(page); > struct address_space *mapping; > - bool page_poisoned = PagePoisoned(page); > bool compound = 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 = ""; > > - /* > - * 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 >= 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) > > 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 char *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); > } > > 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); Hi Matthew, dump_page_owenr() should be called when !PagePoisoned, right? > + if (reason) > + pr_warn("page dumped because: %s\n", reason); > dump_page_owner(page); > } > EXPORT_SYMBOL(dump_page); >