From patchwork Sat Apr 11 22:03:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11484241 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 B7A4492C for ; Sat, 11 Apr 2020 22:04:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 83AED214D8 for ; Sat, 11 Apr 2020 22:04:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cgf+yG0y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83AED214D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 146CA8E00B4; Sat, 11 Apr 2020 18:04:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0CFE38E0007; Sat, 11 Apr 2020 18:04:26 -0400 (EDT) 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 ED9FD8E00B4; Sat, 11 Apr 2020 18:04:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id D41D18E0007 for ; Sat, 11 Apr 2020 18:04:25 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8C15D2C8B for ; Sat, 11 Apr 2020 22:04:25 +0000 (UTC) X-FDA: 76696953690.19.tank38_60d05dc843353 X-Spam-Summary: 2,0,0,37d38bba7a604452,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:4321:5007:6261:6653:7514:8957:9413:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13069:13255:13311:13357:14096:14181:14384:14687:14721:21080:21444:21451:21627:21666:21990:30054,0,RBL:209.85.128.66:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: tank38_60d05dc843353 X-Filterd-Recvd-Size: 4503 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Apr 2020 22:04:25 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id y24so6210586wma.4 for ; Sat, 11 Apr 2020 15:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7awknHCHreVUL7HOgEtOc8fPTfDMmoiQP0NsrxPQ1o8=; b=cgf+yG0ytzZcljetiqszYQFSLXzHNdp4ie3DCzZjeBS7YN3iEEtZTMmns/RaStrAJl dNx0Cx9XpgZEpCvqS+85DM9C/qN0T2ydqQF71ExyeHpWmkkW0FjiCRp/GK8ft5rH6NlW HQG7uT88zPJGoHg39qODkdBkDYncSd1pC7oX7NWFUNGeYHxvUW86wXT6PLCA2q17Cju3 29ffg1/dakVM7ZJyBSKF+3f8K1QZLF05AEQqNPVdFx43ft6xY6ICPb4bpRIpVL0i45UC jwpeFQQRqkYtFzerBwFdtR6u4znwFKE4dE7A9gmA28ArizyHXcbGELzv2duPsSZbpCy6 Oryg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7awknHCHreVUL7HOgEtOc8fPTfDMmoiQP0NsrxPQ1o8=; b=ufGgmt8qeXJkM09zXZGbqwWlgLpg3ULnNJ/e/j/wdcj75UULqcrtqU32ejIUJUR+JH ui6MIno7yMLWyWYHfQ2zTVF2sviFpKYjaiKGALVLy9/hNwynHzJJiYg0Yy6/ySWPw8K6 cAV4acJz6A6Ak/wnuS2MqRGwZxXFgI9gfLdmpHfHE1Sh32M7mnu0GNQ/Zu0KNI979CLz rU9hDK3mnANG7n0jsKpXwnIgKbeLw7CCd1/ezupZgnw0vdorMnyOyKgN+Zu6ABkqDkFQ d3TEilitL14/c/x6DKBIkQqu5jZQtJAYuWLDlJfFF4wuG2RG1hdxmBw/xVKprGhbOgmN s2wQ== X-Gm-Message-State: AGi0PualqiOu95AvYdfhTLGqMCFT5b76kYouqnE/SIWa/JhT916q1VZ2 zHLWD/dm2X7NgDMQaZ7MLzc= X-Google-Smtp-Source: APiQypLJte/8h1XPH3mWhbw57nwf2wLT6tGlCTzV7+vyIqii7e/6lamZUdFuOsmP/vekvPKrUbGV2g== X-Received: by 2002:a1c:8106:: with SMTP id c6mr11350070wmd.88.1586642664302; Sat, 11 Apr 2020 15:04:24 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id h2sm7939369wmb.16.2020.04.11.15.04.23 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Apr 2020 15:04:23 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com, anshuman.khandual@arm.com, david@redhat.com, Wei Yang Subject: [Patch v3 1/5] mm/page_alloc.c: bad_[reason|flags] is not necessary when PageHWPoison Date: Sat, 11 Apr 2020 22:03:53 +0000 Message-Id: <20200411220357.9636-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200411220357.9636-1-richard.weiyang@gmail.com> References: <20200411220357.9636-1-richard.weiyang@gmail.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: Since function returns directly, bad_[reason|flags] is not used any where. And move this to the first. This is a following cleanup for commit e570f56cccd21 ("mm: check_new_page_bad() directly returns in __PG_HWPOISON case") Signed-off-by: Wei Yang Acked-by: Michal Hocko Reviewed-by: David Hildenbrand --- v3: * move this handling to the first case --- mm/page_alloc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f49f28f1220b..7327dc039069 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2037,19 +2037,17 @@ static void check_new_page_bad(struct page *page) const char *bad_reason = NULL; unsigned long bad_flags = 0; + if (unlikely(page->flags & __PG_HWPOISON)) { + /* Don't complain about hwpoisoned pages */ + page_mapcount_reset(page); /* remove PageBuddy */ + return; + } if (unlikely(atomic_read(&page->_mapcount) != -1)) bad_reason = "nonzero mapcount"; if (unlikely(page->mapping != NULL)) bad_reason = "non-NULL mapping"; if (unlikely(page_ref_count(page) != 0)) bad_reason = "nonzero _refcount"; - if (unlikely(page->flags & __PG_HWPOISON)) { - bad_reason = "HWPoisoned (hardware-corrupted)"; - bad_flags = __PG_HWPOISON; - /* Don't complain about hwpoisoned pages */ - page_mapcount_reset(page); /* remove PageBuddy */ - return; - } if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; bad_flags = PAGE_FLAGS_CHECK_AT_PREP;