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 8A571C433F5 for ; Wed, 13 Apr 2022 09:24:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 275D56B0072; Wed, 13 Apr 2022 05:24:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FD886B0073; Wed, 13 Apr 2022 05:24:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0782D6B0074; Wed, 13 Apr 2022 05:24:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id E6CD26B0072 for ; Wed, 13 Apr 2022 05:24:03 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A98B0C1A for ; Wed, 13 Apr 2022 09:24:03 +0000 (UTC) X-FDA: 79351319166.04.3E80FC0 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf17.hostedemail.com (Postfix) with ESMTP id A835340005 for ; Wed, 13 Apr 2022 09:24:02 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kdc525l9hzFptc; Wed, 13 Apr 2022 17:00:54 +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; Wed, 13 Apr 2022 17:03:19 +0800 Subject: Re: [PATCH] mm/memory-failure.c: bail out early if huge zero page To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= CC: Naoya Horiguchi , "akpm@linux-foundation.org" , Linux-MM , Xu Yu , Oscar Salvador References: <49273e6688d7571756603dac996692a15f245d58.1649603963.git.xuyu@linux.alibaba.com> <8f06b79b-aeff-3479-a3cc-c0a649dc770b@huawei.com> <20220412090907.GA350357@u2004> <3eacf09c-e0fe-edde-d81d-ba372c2bad72@huawei.com> <20220413083620.GA3278735@hori.linux.bs1.fc.nec.co.jp> From: Miaohe Lin Message-ID: <094eb114-7c7d-72d8-e64d-ad36952813d7@huawei.com> Date: Wed, 13 Apr 2022 17:03:18 +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: <20220413083620.GA3278735@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Stat-Signature: o4n6oycc5er1yfrkgcss6p61jf449mq4 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A835340005 Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.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-Rspam-User: X-HE-Tag: 1649841842-746184 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/4/13 16:36, HORIGUCHI NAOYA(堀口 直也) wrote: > On Tue, Apr 12, 2022 at 07:08:45PM +0800, Miaohe Lin wrote: > ... >>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c >>> index 9b76222ee237..771fb4fc626c 100644 >>> --- a/mm/memory-failure.c >>> +++ b/mm/memory-failure.c >>> @@ -1852,6 +1852,12 @@ int memory_failure(unsigned long pfn, int flags) >>> } >>> >>> if (PageTransHuge(hpage)) { >>> + if (is_huge_zero_page(hpage)) { >>> + action_result(pfn, MF_MSG_KERNEL_HIGH_ORDER, MF_IGNORED); >>> + res = -EBUSY; >>> + goto unlock_mutex; >>> + } >>> + >> >> It seems that huge_zero_page could be handled simply by zap the corresponding page table without >> loss any user data. > > Yes, zapping all page table entries to huge_zero_page is OK, and I think > that maybe huge_zero_page should be set to NULL. The broken huge_zero page > has no user data, but could have corrupted data (with unexpected non-zero > bits), so it's safer to replace with new zero pages. And > get_huge_zero_page() seems to allocate a new huge zero page if > huge_zero_page is NULL when called, so it would be gracefully switched > to new one on the first later access. Agree. > >> Should we also try to handle this kind of page? Or just bail out as it's rare? > > We should handle it if it's worth doing. I think that memory errors on zero > pages might be rare events (because they occupy small portion of physicall > memory). But if zero pages could be used by many process, the impact of the > error might be non-negligible. Yes, when this becomes non-negligible, we could handle it. :) Thanks. > > Thanks, > Naoya Horiguchi >