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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60A80EB64DD for ; Thu, 20 Jul 2023 09:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbjGTJZW (ORCPT ); Thu, 20 Jul 2023 05:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjGTJZI (ORCPT ); Thu, 20 Jul 2023 05:25:08 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8F872AA6F; Thu, 20 Jul 2023 02:08:02 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R66Gx5Dn5z18LYT; Thu, 20 Jul 2023 17:05:45 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 20 Jul 2023 17:06:30 +0800 Subject: Re: [PATCH] mm/memory-failure: fix hardware poison check in unpoison_memory() To: Sidhartha Kumar , , CC: , , , References: <20230717181812.167757-1-sidhartha.kumar@oracle.com> From: Miaohe Lin Message-ID: <0f1f354b-7308-d170-d84e-3c64161be647@huawei.com> Date: Thu, 20 Jul 2023 17:06:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20230717181812.167757-1-sidhartha.kumar@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/18 2:18, Sidhartha Kumar wrote: > It was pointed out[1] that using folio_test_hwpoison() is wrong > as we need to check the indiviual page that has poison. > folio_test_hwpoison() only checks the head page so go back to using > PageHWPoison(). > > Reported-by: Matthew Wilcox (Oracle) > Fixes: a6fddef49eef ("mm/memory-failure: convert unpoison_memory() to folios") > Cc: stable@vger.kernel.org #v6.4 > Signed-off-by: Sidhartha Kumar > > [1]: https://lore.kernel.org/lkml/ZLIbZygG7LqSI9xe@casper.infradead.org/ > --- > mm/memory-failure.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 02b1d8f104d51..a114c8c3039cd 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -2523,7 +2523,7 @@ int unpoison_memory(unsigned long pfn) > goto unlock_mutex; > } > > - if (!folio_test_hwpoison(folio)) { > + if (!PageHWPoison(p)) { For successfully handled pages, they should be non-compound pages (dissolved, splitted or normal pages). So this patch makes no change for them. But for failed to hwpoisoned thp and hugetlb, there's some difference. But since Naoya points out that, "the users of unpoison should know where the PageHWPoison is set via /proc/kpageflags.", I'm fine with this patch. Reviewed-by: Miaohe Lin Thanks.