Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5786729rwl; Tue, 4 Apr 2023 03:45:22 -0700 (PDT) X-Google-Smtp-Source: AKy350aiYXY+iAZRHgTf1KWa2KmkL1UC+yCzLJ3QvdahiHkcJpW5AL/BXjgqlD3zrPXR7PI1m+6n X-Received: by 2002:a05:6402:3c4:b0:4fc:3777:f630 with SMTP id t4-20020a05640203c400b004fc3777f630mr2126199edw.0.1680605121976; Tue, 04 Apr 2023 03:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680605121; cv=none; d=google.com; s=arc-20160816; b=bWb+ZMsjnzgbXrm3eiamqNSqjRKuKFXlc+nDWeCU41u4YPZKSWPD+1lceZ16wopcfB X5ar+Dcpo2FgJs9oQzLu6qEH60Lu8NIqHVD3oohOTVu2/g4Z5zcLTehKzTQJ6CqVEG6h ZlYXPnevuhEr38o6m1WrSh16UlqM+8thDBxpwFYZHADaDp4vd5ll0yruGRvw0A22T56w snJYD7uehKScgp7ZIhxFK4aVqhbi/GcIBsvsZVWk3Df9sCQTnoP48idzfn0N0n6VMoSx kzk+YtdI6kLCWOFDPdaS/BdV/fTaf+9CK16bnGVfN2IMfEKFumfVfpqD7zHGA1wcEEfO QC9w== 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:subject:user-agent:mime-version:date:message-id; bh=zRvm6YBpAZOXDqkjavOuYCrkQwUz8zS2yHwYJWyOakA=; b=hwBn1Gga3runuO0mwfYOc/GO2//2/7Ws/Vl0hxmHYEUgfYdSfVL+/JQHfGCpru4LUJ A/GRWELFjYUJN5zyLA7zHHaQxsmX3KYXgDUfKDB1v91IrUgYWWPsgNlED53bldikDAFO HIDDdU5+qPBx21FNBTnHo58OxuNjceHugMbyZzKZ6fwqD7/rrY0V7X8cKsZKfk8UmAQC IWuk9CoF76lY/NMoZmQnxWbl9lK1VpEw4rj+1w1RJDfPr9U5ooyPJXeke7AliAzBE6Zm wcMRADC45kjMRYojBK/NzheJgWzvtL/dp1rdSdFzCQqsM+T+pGWSW42OLxIDpIsTWsET UfDg== 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 o2-20020aa7d3c2000000b004e1db2eb805si698128edr.494.2023.04.04.03.44.57; Tue, 04 Apr 2023 03:45:21 -0700 (PDT) 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 S234491AbjDDKmv (ORCPT + 99 others); Tue, 4 Apr 2023 06:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234439AbjDDKmu (ORCPT ); Tue, 4 Apr 2023 06:42:50 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4511110F2 for ; Tue, 4 Apr 2023 03:42:49 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PrPRQ0DqmzKtdk; Tue, 4 Apr 2023 18:40:18 +0800 (CST) Received: from [10.174.177.229] (10.174.177.229) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 4 Apr 2023 18:42:45 +0800 Message-ID: <5e604ce7-8f06-392b-d56a-249abf9b4635@huawei.com> Date: Tue, 4 Apr 2023 18:42:44 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH 2/2] mm: ksm: Support hwpoison for ksm page To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= CC: "akpm@linux-foundation.org" , "linmiaohe@huawei.com" , "wangkefeng.wang@huawei.com" , "sunnanyong@huawei.com" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" References: <20230330074501.205092-1-xialonglong1@huawei.com> <20230330074501.205092-3-xialonglong1@huawei.com> <20230331054243.GB1435482@hori.linux.bs1.fc.nec.co.jp> From: xialonglong In-Reply-To: <20230331054243.GB1435482@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.229] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Thank you very much for your reply. Your suggestion is indeed very helpful and I will take some time to consider how to implement it. Once I have a clear plan, I will send a separate patch to make it happen. Best regards, Longlong Xia 在 2023/3/31 13:42, HORIGUCHI NAOYA(堀口 直也) 写道: > On Thu, Mar 30, 2023 at 03:45:01PM +0800, Longlong Xia wrote: >> hwpoison_user_mappings() is updated to support ksm pages, and add >> collect_procs_ksm() to collect processes when the error hit an ksm >> page. The difference from collect_procs_anon() is that it also needs >> to traverse the rmap-item list on the stable node of the ksm page. >> At the same time, add_to_kill_ksm() is added to handle ksm pages. And >> task_in_to_kill_list() is added to avoid duplicate addition of tsk to >> the to_kill list. This is because when scanning the list, if the pages >> that make up the ksm page all come from the same process, they may be >> added repeatedly. >> >> Signed-off-by: Longlong Xia > > I don't find any specific issue by code review for now, so I'll try to > test your patches. > > I have one comment about duplicated KSM pages. It seems that KSM controls > page duplication by limiting deduplication factor with max_page_sharing, > primarily for performance reason. But I think it's imporant from memory > RAS's viewpoint too because that means we could allow recovery from memory > errors on a KSM page by making affected processes to switch to the duplicated > pages (without killing the processes!). Maybe this might be beyond the scope > of this patchset and I'm not sure how hard it is, but if you are interested > in this issue, that's really nice. > > Thanks, > Naoya Horiguchi