Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6897387rdb; Tue, 2 Jan 2024 18:47:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkifkM504e+KXyb3aadOgMicLG9n2jkqEKlTttQbvdWmCsWlNrCVka4VoaWzvt0mHWFh2u X-Received: by 2002:ac8:7c4c:0:b0:428:340a:d01c with SMTP id o12-20020ac87c4c000000b00428340ad01cmr663739qtv.31.1704250069869; Tue, 02 Jan 2024 18:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704250069; cv=none; d=google.com; s=arc-20160816; b=tEnBpbblVBocYkQeb6IkuqOI1W62cuAxE2hCBmiy87k/4c9cEM+ZQTJDaW+owbvsL9 Vu1DSnsbo4x8+uN+wTV64TUPiit7nqjbfOI8R553UaFa13n0M1faDweHx98LRnfpzoHE jak9hAxtgBYx6gohYqS+S9kzVJ66TTjMgShkr+99WSSJaZA+c2auxcnm1pJ36VWqHcIb CunW0r3iWkjpASjwOrzWgb6KRvMS9AS5JhHnNRlGv3A/d1adXzRKw2Jk21kHr/tjOXwr 7KrF8oYdLDDAxMno8UrSC0/bevGDH9qzx5sA2fNLWuVtyzsJVCaSFE4YF5b3FLQJccFf 6zEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=QPxB4F3tJCuk/Pe6RcopPjyVIf/mAC2mgLtPSjgbmPo=; fh=SdQJMHehZZaFlSlSvKWhe6Bp+O385lpps0BFrdNDcKs=; b=fF3w9zh6o5yc6m5tJpWK7PXe/S3p1fNWy07/xdYDXeuo7GCOenrYzp5KkwhVeOiKHE Xjy1LMiEVCb1WB8cQ6xw3MLsF2I7BTchL/zgbGGLNG3jXF7oWETB/bIFjC4vtvZSRx45 02Xxx3Nu8xlrucBuCvCgjPSax02LwcItcpJZX4gqJh3b6zZ2VU+Qt5n1tBSwT19wyPnI Us495xjYtYfF9oyagYXb3mrclzHiRyp10lVhOmIMU9pRs4dSO5oj0ktl32KMxLBLINNE YQxOYIujcyorBSd6qUbKa2YD0R4QnupyeLzsRgEEwesktz8Xp/M3sApSSw555TNVO2Dx yVNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s14-20020a05622a018e00b004281e540c59si5911237qtw.692.2024.01.02.18.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 18:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9E1971C22C59 for ; Wed, 3 Jan 2024 02:47:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B54617993; Wed, 3 Jan 2024 02:47:42 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30B5717984 for ; Wed, 3 Jan 2024 02:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4T4Yxm0MQ9z1Q7Sd; Wed, 3 Jan 2024 10:46:04 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id E5ECD140444; Wed, 3 Jan 2024 10:47:14 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) 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.2507.35; Wed, 3 Jan 2024 10:47:14 +0800 Subject: Re: [PATCH v2 2/2] mm: memory-failure: Re-split hw-poisoned huge page on -EAGAIN To: "Zhuo, Qiuxu" , Andrew Morton CC: "naoya.horiguchi@nec.com" , "Luck, Tony" , "Huang, Ying" , "Yin, Fengwei" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" References: <20231215081204.8802-1-qiuxu.zhuo@intel.com> <20231222062706.5221-1-qiuxu.zhuo@intel.com> <20231222062706.5221-2-qiuxu.zhuo@intel.com> <20231222114233.68a4fcf2428ae50da6b249f4@linux-foundation.org> From: Miaohe Lin Message-ID: Date: Wed, 3 Jan 2024 10:47:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) On 2024/1/2 10:41, Zhuo, Qiuxu wrote: >> From: Andrew Morton > > Hi Andrew, > > Happy New Year. > Thanks for reviewing the patch. > Please see the comments inline. > >> ... >> >> So we're hoping that when the worker runs to split the page, the process and >> its threads have exited. What guarantees this timing? > > Case 1: If the threads of the victim process do not access the new mapping to > the h/w-poisoned huge page(no refcnt increase), the h/w-poisoned huge page > should be successfully split in the process context. No need for the worker to > split this h/w-poisoned page. > > Case 2: If the threads of the victim process access the new mapping to the > hardware-poisoned huge page (refcnt increase), causing the failure of splitting > the hardware-poisoned huge page, a new MCE will be re-triggered immediately. > Consequently, the process will be promptly terminated upon re-entering the > code below: > > MCE occurs: > memory_failure() > { > { > ... > if (TestSetPageHWPoison(p)) { > ... > kill_accessing_process(current, pfn, flags); > ... > } > ... > } > > The worker splits the h/w-poisoned background with retry delays of 1ms, 2ms, > 4ms, 8ms, ..., 512ms. Before reaching the max 512ms timeout, the process and > its threads should already exit. So, the retry delays can guarantee the timing. > >> And we're hoping that the worker has split the page before userspace >> attempts to restart the process. What guarantees this timing? > > Our experiments showed that an immediate restart of the victim process was > consistently successful. This success could be attributed to the duration between > the process being killed and its subsequent restart being sufficiently long, > allowing the worker enough time to split the hardware-poisoned page. > However, in theory, this timing indeed isn't guaranteed. > >> All this reliance upon fortunate timing sounds rather unreliable, doesn't it? > > The timing of the victim process exit can be guaranteed. > The timing of the new restart of the process cannot be guaranteed in theory. > > The patch is not perfect, but it still provides the victim process with the > opportunity to be restarted successfully. Will it be better if affected process could try re-splitting the hw-poisoned huge page itself before returning to userspace? Each affected process (including possible later restarted process) will try re-splitting huge page in that case and the last one without any competitor will get the work done. So the delayed work is not needed. Will this provide more reliance? Thanks. > > Thanks! > -Qiuxu >