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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 366C9C4332F for ; Mon, 21 Feb 2022 12:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9AA88D0002; Mon, 21 Feb 2022 07:05:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A499A8D0001; Mon, 21 Feb 2022 07:05:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 938B48D0002; Mon, 21 Feb 2022 07:05:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id 86CFA8D0001 for ; Mon, 21 Feb 2022 07:05:39 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3B6869F5CD for ; Mon, 21 Feb 2022 12:05:39 +0000 (UTC) X-FDA: 79166657598.14.63F6DF9 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf08.hostedemail.com (Postfix) with ESMTP id 44E8B160007 for ; Mon, 21 Feb 2022 12:05:38 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4K2LZJ3bDKzcfrY; Mon, 21 Feb 2022 20:04:24 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) 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.2308.21; Mon, 21 Feb 2022 20:05:28 +0800 Subject: Re: [PATCH v4 2/2] mm/hwpoison: Add in-use hugepage hwpoison filter judgement To: luofei , , CC: , References: <20220221021521.2329075-1-luofei@unicloud.com> From: Miaohe Lin Message-ID: <8d4e62ad-1084-6fb6-0b56-6149ee44a960@huawei.com> Date: Mon, 21 Feb 2022 20:05:28 +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: <20220221021521.2329075-1-luofei@unicloud.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 44E8B160007 X-Stat-Signature: y6umwcccwnzuwgt1ne6mzjcnhojx1rex X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam05 X-HE-Tag: 1645445138-991505 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 2022/2/21 10:15, luofei wrote: > After successfully obtaining the reference count of the huge > page, it is still necessary to call hwpoison_filter() to make a > filter judgement, otherwise the filter hugepage will be unmaped > and the related process may be killed. > LGTM. Thanks. Reviewed-by: Miaohe Lin BTW: It seems there is also another missing call to hwpoison_filter() when we encounter free_buddy_page in memory_failure(). But I'am not sure. > Signed-off-by: luofei > --- > mm/memory-failure.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 59d6d939a752..17a7b0a94ab9 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -1548,6 +1548,17 @@ static int memory_failure_hugetlb(unsigned long pfn, int flags) > lock_page(head); > page_flags = head->flags; > > + if (hwpoison_filter(p)) { > + if (TestClearPageHWPoison(head)) > + num_poisoned_pages_dec(); > + put_page(p); > + if (flags & MF_MCE_HANDLE) > + res = -EHWPOISON; > + else > + res = 0; > + goto out; > + } > + > /* > * TODO: hwpoison for pud-sized hugetlb doesn't work right now, so > * simply disable it. In order to make it work properly, we need >