Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1906122ybb; Sat, 11 Apr 2020 15:05:42 -0700 (PDT) X-Google-Smtp-Source: APiQypIaPx1vJinNiLInPQb7TPDQ/lWp6Gaqon3Hmu17iw/XuY7HCh9IkPAXHJozHLbBGDhq++kN X-Received: by 2002:ac8:2398:: with SMTP id q24mr5130395qtq.342.1586642742778; Sat, 11 Apr 2020 15:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586642742; cv=none; d=google.com; s=arc-20160816; b=C7aCvIXRe2OvBW+ueeRLtOCoubn3YRdj/NKqI03dJLWcs1v3PFKIa9NKT/IAcWIx7n azKmmsHMB3snq4D3Sxz3njDAWyN5DcuFpvZHIF/+kxNn91wbBTAJ37WzJg+iRBEjl1qI UI3hCLDVegMSgzkctQvdyY+BuY2rFRTQJ1rEFH2fgTu+AzM4R2pDRfeI99mdE/X3GDZv nyNXJyazJKlmXLaDXNlMvSwApfDmHwUMiw3tKW+DKKUf0qkdRxN2bXf/eGL3ecQTWEmN vamgPXg3UKEHhFEGuDXHdit3JhilULAO0Tn7nioZ9dcj6D7BiWzonxcnHv/Rq/CJyV6e 5vlw== 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:dkim-signature; bh=7awknHCHreVUL7HOgEtOc8fPTfDMmoiQP0NsrxPQ1o8=; b=bamXp0TU/m1HyiCM2nEONBjcZrC26cb234wWQjxUpzG2pauRhAKsldam+RkOqTMSpo Ra5KpaI6ML6YAYDsOMoI98NBda0Bbla8AUVzyZ+c8W7H23G/ft7xnE7iE/TzHzDRA05+ i33XJMTNBg3Svu84/bft56jN7btFD07ciraN2rSB+ZtXIpvrzJEDsQeQcFr7jTAc/bKI PGrHU+HVq9WEnsUX+ka/XEsOMvKdqIE8uYVTtSSnVfBUJ4/m5cx1oknHKJN1EUyvfmqy RCzI0AJoBknmOftku2Sf98Gmf2kpigqvAXzKN2viylR0urBZLkynyr2UPX7WrCzSGD+U 2sag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cgf+yG0y; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 145si3759254qkl.261.2020.04.11.15.05.28; Sat, 11 Apr 2020 15:05:42 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cgf+yG0y; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726865AbgDKWEc (ORCPT + 99 others); Sat, 11 Apr 2020 18:04:32 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36953 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbgDKWEc (ORCPT ); Sat, 11 Apr 2020 18:04:32 -0400 Received: by mail-wm1-f66.google.com with SMTP id z6so6238592wml.2 for ; Sat, 11 Apr 2020 15:04:24 -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=JgTlHfy9n3mA7/WUqNG7PZlUsghkl0Z6ZuerRzQ0WDJ1mCXaH+ls+XIKNgZiuNJiXe TIZkeC3hVvkCF1/QKKo+QinGy1BmVh9Oh4FAxNJ7vUyBSv9vrp5eLGAcw9wTWz1xBGnY GoEbRQ/fRKBzPJtgGXMl3dUkOsjbeZdnG+7on2grnwUKD+4jL/5VBS8BJarfKrDlH60V tTfKBT2TJgopY7adwwbMZYKj0+KADyz1gXgOH3Gd8NVP5l5842o5siZZUpbDwZ288xrD AputBmhQohDrzJhyL32UCX1WMPjtYIxc64eRZ+RlkG5OJOrIhk3KjTUbbwqQRlbIE/KD /qXg== X-Gm-Message-State: AGi0PuZgjblO6WeCFBpSqDqoGdrlrLmLbXMiGAyT+QiRvO33D2e0UlEP 2S+L1F3qbb6l6DLek1A0GnU= 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.23.0