Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6578157rwb; Mon, 12 Dec 2022 03:58:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf7sIqgjOaK8JLZyJCCafx5jO0Fs3P0Zc+ZZb17IyTkj7nH6T2FCQbFJo3hXOQl55QgKKbY6 X-Received: by 2002:a17:906:4ec3:b0:7c1:5169:3ed6 with SMTP id i3-20020a1709064ec300b007c151693ed6mr7345678ejv.48.1670846304268; Mon, 12 Dec 2022 03:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670846304; cv=none; d=google.com; s=arc-20160816; b=kcj9VSrHkB6x0nbCFNz9ABp65tNzfNWdNT261+9DS3/R7mIsfcuAP9Hue8tuPRtUwl XaZ2At9kNQ8X3M4nDhiWZ26YQ25DQsNrPfE73wGlXiNixdGsT3srSe80OGVmKd5IE7Em pO0FmUicFJBKAsv+eYpCfYb+EeD4HhR0wsYdcxqLIWvOZ49N8FXnzFa/Z7QvYP90lbSe oq6WnRXPO1Tulxd52993Z38DG6F6iQg1SIznKhBTeR+3i9SwW4JNrA1sVPzdjktVs4VR tSC77kilQo5cgr58OewcrEYbqnannYMIEsz5DH/WZVKtYwjeJHTurziB7blIwxXQHm6e Arlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=K1/JYJZ2lB3CexUb6QKL2+3tdjatHmwRBJvUDtWEFGc=; b=MVZdOloFpxYgphj+37RhGRYLLt79Kxfmu/tsn8RITswLiY4oeufkV2Vu9p8lZ8VDQY QMuDD5GxH1Xi4wQprS2PivbcjcDAJpCw1YmkcleQViBXeov3o14rfe+hkN0YF++m4k7G /KHV163UuG/7aDLpfPw6iP1Kmu56RI4cRo3IdOrgwcMBw1mpndmz1AZTOkfEaEe48KPv FXHQsTVT1ny3zpyoIJ7nHTqnrgTbPz00eCRfAYvHAnFQSGffKAKJKXY+qV6cll/dnvoa yIUfeSiY0qBdxSLB3FFOXDU01zY2JndDjY5JwBhss8FkohvLLX1akBEFDunwHkpOufbY LY+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xi1-20020a170906dac100b00782627f37d6si6168299ejb.778.2022.12.12.03.58.05; Mon, 12 Dec 2022 03:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232155AbiLLLnr (ORCPT + 75 others); Mon, 12 Dec 2022 06:43:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232339AbiLLLnL (ORCPT ); Mon, 12 Dec 2022 06:43:11 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF50BDEC4 for ; Mon, 12 Dec 2022 03:41:34 -0800 (PST) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NW0785Sc0zmWfw; Mon, 12 Dec 2022 19:40:36 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 12 Dec 2022 19:41:32 +0800 Message-ID: Date: Mon, 12 Dec 2022 19:41:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH -next v2] mm: hwposion: support recovery from ksm_might_need_to_copy() Content-Language: en-US To: Miaohe Lin CC: , , HORIGUCHI NAOYA , Andrew Morton , Linux-MM References: <20221209021525.196276-1-wangkefeng.wang@huawei.com> <20221209072801.193221-1-wangkefeng.wang@huawei.com> <342f4d3f-7347-1615-7d63-cbdef4872629@huawei.com> From: Kefeng Wang In-Reply-To: <342f4d3f-7347-1615-7d63-cbdef4872629@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/12/12 10:36, Miaohe Lin wrote: > On 2022/12/9 15:28, Kefeng Wang wrote: >> When the kernel copy a page from ksm_might_need_to_copy(), but runs >> into an uncorrectable error, it will crash since poisoned page is >> consumed by kernel, this is similar to Copy-on-write poison recovery, >> When an error is detected during the page copy, return VM_FAULT_HWPOISON, >> which help us to avoid system crash. Note, memory failure on a KSM >> page will be skipped, but still call memory_failure_queue() to be >> consistent with general memory failure process. ... > > diff --git a/mm/swapfile.c b/mm/swapfile.c > index 908a529bca12..d479811bc311 100644 > --- a/mm/swapfile.c > +++ b/mm/swapfile.c > @@ -1767,7 +1767,7 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, > > swapcache = page; > page = ksm_might_need_to_copy(page, vma, addr); > - if (unlikely(!page)) > + if (IS_ERR_OR_NULL(page)) > IMHO, it might be better to install a hwpoison entry here. Or later swapoff ops will trigger > the uncorrectable error again? Thanks for you suggestion, will do in v3. > Thanks, > Miaohe Lin >