From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (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 EB47D2494F0; Mon, 30 Mar 2026 07:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774854137; cv=none; b=byM2dGgdBWJczbLRGdRcWtwWovCLml0fqIlUY+QI/kRaSC6qG+RzKlR9E6U2wjsho9ziNybd3OGQWfPZGdVvvbdjJabXK60mvPvMoJ89Qg8cJcUQRs0vyQgrfp8WF2YL8HOmw+1gHKssufKcsYAfxKsBYQk/9U4EkWX/F5yoOtw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774854137; c=relaxed/simple; bh=L4WyrGxKGY2mLjCGh+h5O345MQRT+yiXeFpVgoJ4rSw=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=mFl0yOV9dw34wLADc8yhFgsLFrH/JVDj3082UazYES/WAXF6zOBP8q4HvbwfvJ6pfTB6JaxnOK/Rf0KesgvMYi8MLfDgk/DT2sLZnm5bJIqyP6Fpc/+PJnvPMMEmTAykqyzZvVdRCc9IAMiFDUrf40t5Jd9kL6hmlFA40SZ86J4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=ET0PV2RE; arc=none smtp.client-ip=113.46.200.218 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="ET0PV2RE" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=GhJnq8tM70t/LeoIB8KC+c1fKSsvfayGrRahNCduYkc=; b=ET0PV2REqA05mUNuZDSOpL4GG6YqcTyUCgAEA6QuGHjF1pHqkipPGGlgfhJXaCw8+X2N/9Bmd k+z7DZBKwelquOB19CR7gH1lE92OZZsrSd/evGhRpePP2vtl5epc+kwpr54Bg4Hh/tfCh9AlkHD NU4nbhp175q/e4CXdqxm+14= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4fkhqR42pfzpTHt; Mon, 30 Mar 2026 14:56:19 +0800 (CST) Received: from dggemv712-chm.china.huawei.com (unknown [10.1.198.32]) by mail.maildlp.com (Postfix) with ESMTPS id E58EE40569; Mon, 30 Mar 2026 15:02:03 +0800 (CST) Received: from kwepemq500010.china.huawei.com (7.202.194.235) by dggemv712-chm.china.huawei.com (10.1.198.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 30 Mar 2026 15:02:03 +0800 Received: from [10.173.124.160] (10.173.124.160) by kwepemq500010.china.huawei.com (7.202.194.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 30 Mar 2026 15:02:02 +0800 Subject: Re: [PATCH RFC v2 2/7] mm: memory_failure: Allow truncate_error_folio to return MF_DELAYED To: Lisa Wang CC: , , , , , , , , Naoya Horiguchi , Andrew Morton , "Paolo Bonzini" , Shuah Khan , Hugh Dickins , Baolin Wang , "David Hildenbrand" , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , , , , References: <20260319-memory-failure-mf-delayed-fix-rfc-v2-v2-0-92c596402a7a@google.com> <20260319-memory-failure-mf-delayed-fix-rfc-v2-v2-2-92c596402a7a@google.com> From: Miaohe Lin Message-ID: <2f177e0f-2eb0-48d0-b48c-7a0a340caf5d@huawei.com> Date: Mon, 30 Mar 2026 15:02:01 +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: <20260319-memory-failure-mf-delayed-fix-rfc-v2-v2-2-92c596402a7a@google.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemq500010.china.huawei.com (7.202.194.235) On 2026/3/20 7:30, Lisa Wang wrote: > The .error_remove_folio a_ops is used by different filesystems to handle > folio truncation upon discovery of a memory failure in the memory > associated with the given folio. > > Currently, MF_DELAYED is treated as an error, causing "Failed to punch > page" to be written to the console. MF_DELAYED is then relayed to the > caller of truncate_error_folio() as MF_FAILED. This further causes > memory_failure() to return -EBUSY, which then always causes a SIGBUS. > > This is also implies that regardless of whether the thread's memory > corruption kill policy is PR_MCE_KILL_EARLY or PR_MCE_KILL_LATE, a > memory failure with MF_DELAYED will always cause a SIGBUS. > > Update truncate_error_folio() to return MF_DELAYED to the caller if the > .error_remove_folio() callback reports MF_DELAYED. > > Signed-off-by: Lisa Wang > --- > mm/memory-failure.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 4f143334d5a1..57f7762e7418 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -941,6 +941,8 @@ static int truncate_error_folio(struct folio *folio, unsigned long pfn, > if (mapping->a_ops->error_remove_folio) { > int err = mapping->a_ops->error_remove_folio(mapping, folio); > > + if (err == MF_DELAYED) > + return err; Will it be better to add a pr_info here to provide some information for users? Thanks. .