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 70D2BC433F5 for ; Thu, 28 Apr 2022 02:23:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF36A6B0071; Wed, 27 Apr 2022 22:23:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA23D6B0072; Wed, 27 Apr 2022 22:23:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D90B06B0073; Wed, 27 Apr 2022 22:23:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id C6F876B0071 for ; Wed, 27 Apr 2022 22:23:10 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7755B61B00 for ; Thu, 28 Apr 2022 02:23:10 +0000 (UTC) X-FDA: 79404690540.11.2B5FE8E Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf04.hostedemail.com (Postfix) with ESMTP id CEFE440068 for ; Thu, 28 Apr 2022 02:23:04 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KpfRr6kX8zCqvn; Thu, 28 Apr 2022 10:18:32 +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.2375.24; Thu, 28 Apr 2022 10:23:06 +0800 Subject: Re: [PATCH 1/2] Revert "mm/memory-failure.c: skip huge_zero_page in memory_failure()" To: Xu Yu CC: , , , Linux-MM References: <872cefb182ba1dd686b0e7db1e6b2ebe5a4fff87.1651039624.git.xuyu@linux.alibaba.com> From: Miaohe Lin Message-ID: <480640f2-8bee-692c-2beb-24d36774d5b1@huawei.com> Date: Thu, 28 Apr 2022 10:23:05 +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: <872cefb182ba1dd686b0e7db1e6b2ebe5a4fff87.1651039624.git.xuyu@linux.alibaba.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: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CEFE440068 X-Stat-Signature: hgz6zye5p3yc9hab4axf196c956c7goh X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-HE-Tag: 1651112584-151748 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/4/27 14:10, Xu Yu wrote: > This reverts commit d173d5417fb67411e623d394aab986d847e47dad. > > The commit d173d5417fb6 ("mm/memory-failure.c: skip huge_zero_page in > memory_failure()") explicitly skips huge_zero_page in memory_failure(), > in order to avoid triggering VM_BUG_ON_PAGE on huge_zero_page in > split_huge_page_to_list(). > > This works, but Yang Shi thinks that, > > Raising BUG is overkilling for splitting huge_zero_page. The > huge_zero_page can't be met from normal paths other than memory > failure, but memory failure is a valid caller. So I tend to replace > the BUG to WARN + returning -EBUSY. If we don't care about the > reason code in memory failure, we don't have to touch memory > failure. > > And for the issue that huge_zero_page will be set PG_has_hwpoisoned, > Yang Shi comments that, > > The anonymous page fault doesn't check if the page is poisoned or > not since it typically gets a fresh allocated page and assumes the > poisoned page (isolated successfully) can't be reallocated again. > But huge zero page and base zero page are reused every time. So no > matter what fix we pick, the issue is always there. > > Finally, Yang, David, Anshuman and Naoya all agree to fix the bug, i.e., > to split huge_zero_page, in split_huge_page_to_list(). > > This reverts the commit d173d5417fb6 ("mm/memory-failure.c: skip > huge_zero_page in memory_failure()"), and the original bug will be fixed > by the next patch. > > Suggested-by: Yang Shi > Cc: Naoya Horiguchi > Signed-off-by: Xu Yu LGTM. Thanks! Reviewed-by: Miaohe Lin > --- > mm/memory-failure.c | 13 ------------- > 1 file changed, 13 deletions(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 27760c19bad7..2020944398c9 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -1860,19 +1860,6 @@ int memory_failure(unsigned long pfn, int flags) > } > > if (PageTransHuge(hpage)) { > - /* > - * Bail out before SetPageHasHWPoisoned() if hpage is > - * huge_zero_page, although PG_has_hwpoisoned is not > - * checked in set_huge_zero_page(). > - * > - * TODO: Handle memory failure of huge_zero_page thoroughly. > - */ > - if (is_huge_zero_page(hpage)) { > - action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); > - res = -EBUSY; > - goto unlock_mutex; > - } > - > /* > * The flag must be set after the refcount is bumped > * otherwise it may race with THP split. >