Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp234639rdh; Mon, 18 Dec 2023 18:18:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEE19gAKEeHLqhOe2L7GH2Im25Fb73xERstuwQBVBgp+wTuDzN7h5FYsvYjtCn1WLqIN+pi X-Received: by 2002:a05:6808:648b:b0:3ba:5dd:946c with SMTP id fh11-20020a056808648b00b003ba05dd946cmr21248547oib.4.1702952288854; Mon, 18 Dec 2023 18:18:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702952288; cv=none; d=google.com; s=arc-20160816; b=e4oM8mTxcIvYoJcNqkkG/4B808kkkFGssnmjmLiHfjtPGnM2F5PGAEJjOHCBWU7J3H dKk9aYaQUzZLXg13Kc15dlh2Qc1pueBfMNpyQN+UCz3tHvWQbxNi9Gj7CQPDua7SOkGf oRJXPdmslspwIenOBKkNTnnxvJPz9RGlwFAKjmSRN2cn7elv/05KRkVlH5QokKSnCHmd tlTsoGSe8W7vo328kJOKm/jjtDOgc1IxtOT4goBdI4t44m/XAb1O5JwH1PXeMkO2nRMh Po0gPq+n0VqD+P4ZIZGuuahza1x6304qnsrteU1r+qujTHdQewOllLcHmShoXN5Zq3ii 84Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=N4TtHcq2TsQinuDWqHZmTllB2P81yCAywzsZcw90ozs=; fh=35uKfVSQP/Ui9EuDl78yNU+HhiYqBBg3Nxj3NBtDREw=; b=ikZCMvgAvctuH/gZF7gloqksbG/7O6x+3xFAJnkuSWv/vQ4nS53/d6UHO+3aqFgHyO oMhroRuyyXLAVmpkbEWHKiJ/kYy5x5PgLUHO1zhMa31ru0x3UsH/MZQpHFFb5OWH9jOF BmHwHRCVzbCudgHtvU3aR1lewYAhis69BykS6f7H7sNYcgB9vzUzbSwZFMGdbRI/KFeF Sn0x2tSWQREfoGzsioVrCov51mr/v0ZXrIcfPbLjTzSmT+Mwp0NXqYQeM8ISg//C9yC6 Q0nki1OpR7K2D0Fsa2cYwBgzmLcL9sQwwDwdcJpvoRqZdbiAuH+kcfzOvq6bN2WSxPxx hf3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UME3Rd6j; spf=pass (google.com: domain of linux-kernel+bounces-4582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4582-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c7-20020a170902d48700b001cc5ada2b94si19427565plg.366.2023.12.18.18.18.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 18:18:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UME3Rd6j; spf=pass (google.com: domain of linux-kernel+bounces-4582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4582-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E4A88B23CFC for ; Tue, 19 Dec 2023 02:18:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E728C63D1; Tue, 19 Dec 2023 02:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="UME3Rd6j" X-Original-To: linux-kernel@vger.kernel.org Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 5065E5CA1 for ; Tue, 19 Dec 2023 02:17:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Tue, 19 Dec 2023 11:17:23 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702952253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=N4TtHcq2TsQinuDWqHZmTllB2P81yCAywzsZcw90ozs=; b=UME3Rd6jOx+6ABruQyvRk7rn9I34Rg6jpkAmKCkH52EWEfumChHEUEMTwavXXBQGnN7lKR fJsJiQO4iRHn0KGJ5iphl/993ZCsLO/yiAyO+FGwKdvlS2kM19/WcU1FmhmQMYdlU9PY7k SXiPI0G9/C3imBGdnEj2Ugf7Yxh1G1M= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Naoya Horiguchi To: Qiuxu Zhuo Cc: naoya.horiguchi@nec.com, linmiaohe@huawei.com, akpm@linux-foundation.org, tony.luck@intel.com, ying.huang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] mm: memory-failure: Re-split hw-poisoned huge page on -EAGAIN Message-ID: <20231219021723.GA158136@ik1-406-35019.vs.sakura.ne.jp> References: <20231215081204.8802-1-qiuxu.zhuo@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231215081204.8802-1-qiuxu.zhuo@intel.com> X-Migadu-Flow: FLOW_OUT On Fri, Dec 15, 2023 at 04:12:04PM +0800, Qiuxu Zhuo wrote: > During the process of splitting a hw-poisoned huge page, it is possible > for the reference count of the huge page to be increased by the threads > within the affected process, leading to a failure in splitting the > hw-poisoned huge page with an error code of -EAGAIN. > > This issue can be reproduced when doing memory error injection to a > multiple-thread process, and the error occurs within a huge page. > The call path with the returned -EAGAIN during the testing is shown below: > > memory_failure() > try_to_split_thp_page() > split_huge_page() > split_huge_page_to_list() { > ... > Step A: can_split_folio() - Checked that the thp can be split. > Step B: unmap_folio() > Step C: folio_ref_freeze() - Failed and returned -EAGAIN. > ... > } > > The testing logs indicated that some huge pages were split successfully > via the call path above (Step C was successful for these huge pages). > However, some huge pages failed to split due to a failure at Step C, and > it was observed that the reference count of the huge page increased between > Step A and Step C. > > Testing has shown that after receiving -EAGAIN, simply re-splitting the > hw-poisoned huge page within memory_failure() always results in the same > -EAGAIN. This is possible because memory_failure() is executed in the > currently affected process. Before this process exits memory_failure() and > is terminated, its threads could increase the reference count of the > hw-poisoned page. > > To address this issue, employ the kernel worker to re-split the hw-poisoned > huge page. By the time this worker begins re-splitting the hw-poisoned huge > page, the affected process has already been terminated, preventing its > threads from increasing the reference count. Experimental results have > consistently shown that this worker successfully re-splits these > hw-poisoned huge pages on its first attempt. > > The kernel log (before): > [ 1116.862895] Memory failure: 0x4097fa7: recovery action for unsplit thp: Ignored > > The kernel log (after): > [ 793.573536] Memory failure: 0x2100dda: recovery action for unsplit thp: Delayed > [ 793.574666] Memory failure: 0x2100dda: split unsplit thp successfully. I'm unclear about the user-visible benefit of ensuring that the error thp is split. So could you explain about it? I think that the raw error page is not unmapped (with hwpoisoned entry) after delayed re-splitting, so recovery action seems not complete even with this patch. So this patch seems to just convert a hwpoisoned unrecovered thp into a hwpoisoned unrecovered raw page. Thanks, Naoya Horiguchi