From patchwork Tue Mar 22 21:46:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7043FC433FE for ; Tue, 22 Mar 2022 21:46:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 02E346B0164; Tue, 22 Mar 2022 17:46:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1F8A6B0165; Tue, 22 Mar 2022 17:46:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE7736B0166; Tue, 22 Mar 2022 17:46:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id CD2B86B0164 for ; Tue, 22 Mar 2022 17:46:42 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 9949981A3D for ; Tue, 22 Mar 2022 21:46:42 +0000 (UTC) X-FDA: 79273357044.13.3C6F1E3 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf28.hostedemail.com (Postfix) with ESMTP id 0829CC0037 for ; Tue, 22 Mar 2022 21:46:41 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E7316B81DAF; Tue, 22 Mar 2022 21:46:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E875C340EC; Tue, 22 Mar 2022 21:46:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985599; bh=jedrvYwFspMSMsyT77JGhwiWtvwDzGhVLUBNE0+fuGg=; h=Date:To:From:In-Reply-To:Subject:From; b=z+c8GO9uLdRpXBnRpB75QxO0Az8B6Qf7dFo31CUWKSGchQ60fA1CYCFVFpUlyNI+D wT43ZMBv+6kdyo6jRVkspCt94d6jGjXapjlvD9UYGepsoHdAYtN7n3LvKQE3rTpvP3 tb3QCCYdOUkRPatb3IZpLFR+JEKZH+y4v070+faA= Date: Tue, 22 Mar 2022 14:46:38 -0700 To: shy828301@gmail.com,rientjes@google.com,naoya.horiguchi@nec.com,mike.kravetz@oracle.com,willy@infradead.org,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 160/227] mm/hwpoison: check the subpage, not the head page Message-Id: <20220322214639.8E875C340EC@smtp.kernel.org> X-Rspam-User: X-Stat-Signature: 7wtmb67obno6ssy6e1wpyg974f8re4sr Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=z+c8GO9u; spf=pass (imf28.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0829CC0037 X-HE-Tag: 1647985601-287898 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: From: "Matthew Wilcox (Oracle)" Subject: mm/hwpoison: check the subpage, not the head page Hardware poison is tracked on a per-page basis, not on the head page. Link: https://lkml.kernel.org/r/20220130013042.1906881-1-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Naoya Horiguchi Reviewed-by: Yang Shi Cc: David Rientjes Cc: Mike Kravetz Signed-off-by: Andrew Morton --- mm/rmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/rmap.c~mm-hwpoison-check-the-subpage-not-the-head-page +++ a/mm/rmap.c @@ -1553,7 +1553,7 @@ static bool try_to_unmap_one(struct page /* Update high watermark before we lower rss */ update_hiwater_rss(mm); - if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) { + if (PageHWPoison(subpage) && !(flags & TTU_IGNORE_HWPOISON)) { pteval = swp_entry_to_pte(make_hwpoison_entry(subpage)); if (PageHuge(page)) { hugetlb_count_sub(compound_nr(page), mm); @@ -1873,7 +1873,7 @@ static bool try_to_migrate_one(struct pa * memory are supported. */ subpage = page; - } else if (PageHWPoison(page)) { + } else if (PageHWPoison(subpage)) { pteval = swp_entry_to_pte(make_hwpoison_entry(subpage)); if (PageHuge(page)) { hugetlb_count_sub(compound_nr(page), mm);