From nobody Wed Feb 11 11:30:22 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 82B2D14A4DF for ; Tue, 21 May 2024 23:55:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335717; cv=none; b=BXhQdh1NIfhUzz79PhWhjyBruTSAzvnM1rSDsvh2855WBQHxy5Iei8Gz8fpAzWS7zlaofb3EsezMpn2/FfiGzD2lB40iw9ujOdQYDq2w3Pk2O0awG9WupYYm08y42zGq4BpBpL7NnbCVE0nyaz2jxuhsgQDWJ/Fs++LwZ3DdoXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335717; c=relaxed/simple; bh=xR/G2YwzoliqJGu1LnJE7SfCRlqGE6/LuzyY4cSKnBI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hg8dFzf3msbQkOJUWxRP6YT/rOI+YIJc5t/xKkBEyUioh+1nvOqvdGIxloRvYneuZN3ib1Rvvsmzlcs7xqeu8vU9fU0VdDrqp21W96IUMbwn077AR4NPTEqLTbQNDFGwfJc9v5DpwmnHfPkGy4+bpF7k9c+9geZ4IuLPThtyT6E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ozaHhLK3; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ozaHhLK3" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LJi3AL011519; Tue, 21 May 2024 23:55:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=aVvMSdU9di+/pg8Z/YTSNT+1WpNBkHB9jxFSgsTIf2I=; b=ozaHhLK3zTKdc2Hph/rlUXGL/acHXan8W2VjZFKVnfmWjoysXZ+EKLGG0vFyu/tvrPya YCF8MOAdfRcfbqCoYhyYwZHcEC7A5CVpcihcTC4H4SLMcSosNGiRqLRREaNFvk5+Yph+ /3ODhSVoGnP4hTcU0GttTiST2tUhqyX85HZ3zgnZ0EO5B4s2SHY2HcRwqGaZGnhk4/k1 HKVu+8RM0pY6Zdo6223C17NDHPOs9lkC+Y2hCkNWK+9R0JpRMivj9X4oytzJRRBN1Xi2 rq2q/ELDQkZKru9HB5FqHGtqk1ArG7jiEjBhpZN48XcBjCr8hpjLdN9oFYWX0+olMErw Cw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6mcdxkkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 23:55:01 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44LMZkKS002667; Tue, 21 May 2024 23:55:00 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3y6js8erce-2; Tue, 21 May 2024 23:55:00 +0000 From: Jane Chu To: linmiaohe@huawei.com, nao.horiguchi@gmail.com, akpm@linux-foundation.org, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] mm/memory-failure: try to send SIGBUS even if unmap failed Date: Tue, 21 May 2024 17:54:25 -0600 Message-Id: <20240521235429.2368017-2-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240521235429.2368017-1-jane.chu@oracle.com> References: <20240521235429.2368017-1-jane.chu@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_14,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210181 X-Proofpoint-ORIG-GUID: B4WTxpJGzidQZfA17erZRzLWZ4zjq7Hs X-Proofpoint-GUID: B4WTxpJGzidQZfA17erZRzLWZ4zjq7Hs Content-Type: text/plain; charset="utf-8" For years when it comes down to kill a process due to hwpoison, a SIGBUS is delivered only if unmap has been successful. Otherwise, a SIGKILL is delivered. And the reason for that is to prevent the involved process from accessing the hwpoisoned page again. Since then a lot has changed, a hwpoisoned page is marked and upon being re-accessed, the memory-failure handler invokes kill_accessing_process() to kill the process immediately. So let's take out the '!unmap_success' factor and try to deliver SIGBUS if possible. Signed-off-by: Jane Chu Reviewed-by: Oscar Salvador Acked-by: Miaohe Lin --- mm/memory-failure.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 16ada4fb02b7..739311e121af 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -514,22 +514,15 @@ void add_to_kill_ksm(struct task_struct *tsk, struct = page *p, * * Only do anything when FORCEKILL is set, otherwise just free the * list (this is used for clean pages which do not need killing) - * Also when FAIL is set do a force kill because something went - * wrong earlier. */ -static void kill_procs(struct list_head *to_kill, int forcekill, bool fail, +static void kill_procs(struct list_head *to_kill, int forcekill, unsigned long pfn, int flags) { struct to_kill *tk, *next; =20 list_for_each_entry_safe(tk, next, to_kill, nd) { if (forcekill) { - /* - * In case something went wrong with munmapping - * make sure the process doesn't catch the - * signal and then access the memory. Just kill it. - */ - if (fail || tk->addr =3D=3D -EFAULT) { + if (tk->addr =3D=3D -EFAULT) { pr_err("%#lx: forcibly killing %s:%d because of failure to unmap corru= pted page\n", pfn, tk->tsk->comm, tk->tsk->pid); do_send_sig_info(SIGKILL, SEND_SIG_PRIV, @@ -1660,7 +1653,7 @@ static bool hwpoison_user_mappings(struct folio *foli= o, struct page *p, */ forcekill =3D folio_test_dirty(folio) || (flags & MF_MUST_KILL) || !unmap_success; - kill_procs(&tokill, forcekill, !unmap_success, pfn, flags); + kill_procs(&tokill, forcekill, pfn, flags); =20 return unmap_success; } @@ -1724,7 +1717,7 @@ static void unmap_and_kill(struct list_head *to_kill,= unsigned long pfn, unmap_mapping_range(mapping, start, size, 0); } =20 - kill_procs(to_kill, flags & MF_MUST_KILL, false, pfn, flags); + kill_procs(to_kill, flags & MF_MUST_KILL, pfn, flags); } =20 /* --=20 2.39.3 From nobody Wed Feb 11 11:30:22 2026 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 52D8D58AB9 for ; Tue, 21 May 2024 23:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335718; cv=none; b=cN045tGrpka/YVZ6er92R7DgDYirZF66jsPcTHlcNWFjKbs63N8MzMkljUol6HQS2E97vRUTPYMznS4Jgi/E749qS/cPGMBpjbvPX8squ5B77hWLshgCavtEGQdfIVqpNK2UfJ+0wLGi34JLdlKk91oCnpkPZ4nTvq9231h1WVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335718; c=relaxed/simple; bh=bu3dUrEttL0jhrzOAsEVq2ALqieoahCw/j2brR0L42A=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PeDTZKUHT/ZdoMkbzOyruIlZ35/leVTxj4Xw+q5FHpt9yMPUtad6IjfMJ/II2wBk7kxHWvrC/q7hZnQdyhVoKAVsdztYvrLO3e4DUV9XHYq4DpsddtYLRWMVLrC1dnsFVAdwyVNOQBS2cVEidZW9tR2lmz7o/CcSMRNeLnHU4j4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=g6cUrmqR; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="g6cUrmqR" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LJkCvG016732; Tue, 21 May 2024 23:55:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=uGf2vROyvg6ZwMJ/Hw9eQH29lzC7eJMyJb27dxpCla8=; b=g6cUrmqR0x6RsZLklZW3C4yPOprOOlqOabivyLBi5K34GjPi1uBH4gEk33FmgbZijwgo yL5DHU5SbsvaTOe2Mpsin+IDSQyt3m5kix9y2mHjY1GsheO09ZlAvUT0wTGZ9q4ZHMc4 SCMHgSJDmicGy1fnDevChzwRdfStdVdgExvqtnuDDeR7s24DtvJkXfIXJIQ7VbklfuGo xNvCuTtvOXVZvoPsFT1Xdb0PH4SfStl41HmzY0K/Rov+ETG5RUKOTOL4kt/WiPD1pzaG ktn4cwsBAGqOdsUapynVBGGDWyfDHn8rYty9cHDU5+MHNSFB930W16IhsUwIeoflVuCx bQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6jx2efc5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 23:55:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44LMZkKT002667; Tue, 21 May 2024 23:55:05 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3y6js8erce-3; Tue, 21 May 2024 23:55:05 +0000 From: Jane Chu To: linmiaohe@huawei.com, nao.horiguchi@gmail.com, akpm@linux-foundation.org, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/5] mm/madvise: Add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON) Date: Tue, 21 May 2024 17:54:26 -0600 Message-Id: <20240521235429.2368017-3-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240521235429.2368017-1-jane.chu@oracle.com> References: <20240521235429.2368017-1-jane.chu@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_14,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210181 X-Proofpoint-GUID: s8TZqutMV_sNhtOaqmw9r6gFiSZXwMpt X-Proofpoint-ORIG-GUID: s8TZqutMV_sNhtOaqmw9r6gFiSZXwMpt Content-Type: text/plain; charset="utf-8" The soft hwpoison injector via madvise(MADV_HWPOISON) operates in a synchrous way in a sense, the injector is also a process under test, and should it have the poisoned page mapped in its address space, it should get killed as much as in a real UE situation. Doing so align with what the madvise(2) man page says: " "This operation may result in the calling process receiving a SIGBUS and the page being unmapped." Signed-off-by: Jane Chu Reviewed-by: Oscar Salvador Acked-by: Miaohe Lin --- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/madvise.c b/mm/madvise.c index c8ba3f3eb54d..d8a01d7b2860 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1147,7 +1147,7 @@ static int madvise_inject_error(int behavior, } else { pr_info("Injecting memory failure for pfn %#lx at process virtual addre= ss %#lx\n", pfn, start); - ret =3D memory_failure(pfn, MF_COUNT_INCREASED | MF_SW_SIMULATED); + ret =3D memory_failure(pfn, MF_ACTION_REQUIRED | MF_COUNT_INCREASED | M= F_SW_SIMULATED); if (ret =3D=3D -EOPNOTSUPP) ret =3D 0; } --=20 2.39.3 From nobody Wed Feb 11 11:30:22 2026 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 8AD18149DEC for ; Tue, 21 May 2024 23:55:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335750; cv=none; b=JaNgTIHZgkaxyV7Nb5al5jyFxUTQB3DOwxE/B4+xXxl+M2JjNgG0Uv4m+VZHb8lsbLa+61TNdt0h41cwWSNMb0fJeWd3I9xOxUvaiHKYF+vYp6j/iFKHh/yoocOQr5sHIxbjUWy++d9pbA9Jlg4RefAXqc5vbN1/YYGkUuWfRgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335750; c=relaxed/simple; bh=NB2jyb5H8LkQB9X2o+xFzjZ2NRKzw7+VkG8ZmX9AVy0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d3nCOc/7D762X92sYilSgVOpT+1vv5HNvhUCSijEKg1x+2Q+pSieUkJiJ+GcnvlKxAKVDDW4H4ufd107yY62JydeqSPWTPAypuqQm5s3Eir9HkXGkQDejWlWDX2A5lh1Iyx8j3VOYg5jFRXW4n1+azZRttr3LuNE6KrTjzVeZks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=eQwrzgK3; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="eQwrzgK3" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LJkHCC013661; Tue, 21 May 2024 23:55:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=z1prDriYsI1wDXlPHr/vQoqHCvjGzLHUUrEOL1odZwA=; b=eQwrzgK3aMomHfB7BcblbNJAV6zG7N5li0pTBG3/PANsHRjFFClVxSG/0iv1hdzzVik0 v43Hb76Z/loeDVLJ25W7WhaSHhRI4wYwUVUhHGG1w35EOwGBUH1M5nBLCpGYC/NbcFEs 6HFrOyPu8EKSaLfiB5MaJHGD3g/zm97+lDJz8ODp7TGXc1xZ0wr793eHT0qmlNaBU4h3 kOM81VIUcEodc/lAR1XqpfzongQK+7JQR9ijLMP9JoPpBk1IBhk7+fTvmwqDN7ez0gAC 9eWxMn7u+VgfQbpzYDDaJdZbSpbgknlAe9LgiAMQsIRaW/KSOgnWCwNgu0d4cvMG/Dl6 SQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6mvv6gts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 23:55:36 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44LMZkKX002667; Tue, 21 May 2024 23:55:35 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3y6js8erce-4; Tue, 21 May 2024 23:55:34 +0000 From: Jane Chu To: linmiaohe@huawei.com, nao.horiguchi@gmail.com, akpm@linux-foundation.org, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] mm/memory-failure: improve memory failure action_result messages Date: Tue, 21 May 2024 17:54:27 -0600 Message-Id: <20240521235429.2368017-4-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240521235429.2368017-1-jane.chu@oracle.com> References: <20240521235429.2368017-1-jane.chu@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_14,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=869 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210182 X-Proofpoint-ORIG-GUID: KXCpqkLnQd7MXtvCJkmrwN85KoMMhWcb X-Proofpoint-GUID: KXCpqkLnQd7MXtvCJkmrwN85KoMMhWcb Content-Type: text/plain; charset="utf-8" Added two explicit MF_MSG messages describing failure in get_hwpoison_page. Attemped to document the definition of various action names, and made a few adjustment to the action_result() calls. Signed-off-by: Jane Chu Acked-by: Miaohe Lin Reviewed-by: Oscar Salvador --- include/linux/mm.h | 2 ++ include/ras/ras_event.h | 2 ++ mm/memory-failure.c | 38 +++++++++++++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9849dfda44d4..b4598c6a393a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4111,6 +4111,7 @@ enum mf_action_page_type { MF_MSG_DIFFERENT_COMPOUND, MF_MSG_HUGE, MF_MSG_FREE_HUGE, + MF_MSG_GET_HWPOISON, MF_MSG_UNMAP_FAILED, MF_MSG_DIRTY_SWAPCACHE, MF_MSG_CLEAN_SWAPCACHE, @@ -4124,6 +4125,7 @@ enum mf_action_page_type { MF_MSG_BUDDY, MF_MSG_DAX, MF_MSG_UNSPLIT_THP, + MF_MSG_ALREADY_POISONED, MF_MSG_UNKNOWN, }; =20 diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h index c011ea236e9b..b3f6832a94fe 100644 --- a/include/ras/ras_event.h +++ b/include/ras/ras_event.h @@ -360,6 +360,7 @@ TRACE_EVENT(aer_event, EM ( MF_MSG_DIFFERENT_COMPOUND, "different compound page after locking" )= \ EM ( MF_MSG_HUGE, "huge page" ) \ EM ( MF_MSG_FREE_HUGE, "free huge page" ) \ + EM ( MF_MSG_GET_HWPOISON, "get hwpoison page" ) \ EM ( MF_MSG_UNMAP_FAILED, "unmapping failed page" ) \ EM ( MF_MSG_DIRTY_SWAPCACHE, "dirty swapcache page" ) \ EM ( MF_MSG_CLEAN_SWAPCACHE, "clean swapcache page" ) \ @@ -373,6 +374,7 @@ TRACE_EVENT(aer_event, EM ( MF_MSG_BUDDY, "free buddy page" ) \ EM ( MF_MSG_DAX, "dax page" ) \ EM ( MF_MSG_UNSPLIT_THP, "unsplit thp" ) \ + EM ( MF_MSG_ALREADY_POISONED, "already poisoned" ) \ EMe ( MF_MSG_UNKNOWN, "unknown page" ) =20 /* diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 739311e121af..1e22d73c9329 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -879,6 +879,28 @@ static int kill_accessing_process(struct task_struct *= p, unsigned long pfn, return ret > 0 ? -EHWPOISON : -EFAULT; } =20 +/* + * MF_IGNORED - The m-f() handler marks the page as PG_hwpoisoned'ed. + * But it could not do more to isolate the page from being accessed again, + * nor does it kill the process. This is extremely rare and one of the + * potential causes is that the page state has been changed due to + * underlying race condition. This is the most severe outcomes. + * + * MF_FAILED - The m-f() handler marks the page as PG_hwpoisoned'ed. It + * should have killed the process, but it can't isolate the page, due to + * conditions such as extra pin, unmap failure, etc. Accessing the page + * again will trigger another MCE and the process will be killed by the + * m-f() handler immediately. + * + * MF_DELAYED - The m-f() handler marks the page as PG_hwpoisoned'ed. The + * page is unmapped, but perhaps remains in LRU or file mapping. An attempt + * to access the page again will trigger page fault and the PF handler + * will kill the process. + * + * MF_RECOVERED - The m-f() handler marks the page as PG_hwpoisoned'ed. + * The page has been completely isolated, that is, unmapped, taken out of + * the buddy system, or hole-punnched out of the file mapping. + */ static const char *action_name[] =3D { [MF_IGNORED] =3D "Ignored", [MF_FAILED] =3D "Failed", @@ -893,6 +915,7 @@ static const char * const action_page_types[] =3D { [MF_MSG_DIFFERENT_COMPOUND] =3D "different compound page after locking", [MF_MSG_HUGE] =3D "huge page", [MF_MSG_FREE_HUGE] =3D "free huge page", + [MF_MSG_GET_HWPOISON] =3D "get hwpoison page", [MF_MSG_UNMAP_FAILED] =3D "unmapping failed page", [MF_MSG_DIRTY_SWAPCACHE] =3D "dirty swapcache page", [MF_MSG_CLEAN_SWAPCACHE] =3D "clean swapcache page", @@ -906,6 +929,7 @@ static const char * const action_page_types[] =3D { [MF_MSG_BUDDY] =3D "free buddy page", [MF_MSG_DAX] =3D "dax page", [MF_MSG_UNSPLIT_THP] =3D "unsplit thp", + [MF_MSG_ALREADY_POISONED] =3D "already poisoned", [MF_MSG_UNKNOWN] =3D "unknown page", }; =20 @@ -1013,12 +1037,13 @@ static int me_kernel(struct page_state *ps, struct = page *p) =20 /* * Page in unknown state. Do nothing. + * This is a catch-all in case we fail to make sense of the page state. */ static int me_unknown(struct page_state *ps, struct page *p) { pr_err("%#lx: Unknown page state\n", page_to_pfn(p)); unlock_page(p); - return MF_FAILED; + return MF_IGNORED; } =20 /* @@ -2055,6 +2080,8 @@ static int try_memory_failure_hugetlb(unsigned long p= fn, int flags, int *hugetlb if (flags & MF_ACTION_REQUIRED) { folio =3D page_folio(p); res =3D kill_accessing_process(current, folio_pfn(folio), flags); + action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED); + return res; } return res; } else if (res =3D=3D -EBUSY) { @@ -2062,7 +2089,7 @@ static int try_memory_failure_hugetlb(unsigned long p= fn, int flags, int *hugetlb flags |=3D MF_NO_RETRY; goto retry; } - return action_result(pfn, MF_MSG_UNKNOWN, MF_IGNORED); + return action_result(pfn, MF_MSG_GET_HWPOISON, MF_IGNORED); } =20 folio =3D page_folio(p); @@ -2097,7 +2124,7 @@ static int try_memory_failure_hugetlb(unsigned long p= fn, int flags, int *hugetlb =20 if (!hwpoison_user_mappings(folio, p, pfn, flags)) { folio_unlock(folio); - return action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED); + return action_result(pfn, MF_MSG_UNMAP_FAILED, MF_FAILED); } =20 return identify_page_state(pfn, p, page_flags); @@ -2231,6 +2258,7 @@ int memory_failure(unsigned long pfn, int flags) res =3D kill_accessing_process(current, pfn, flags); if (flags & MF_COUNT_INCREASED) put_page(p); + action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED); goto unlock_mutex; } =20 @@ -2267,7 +2295,7 @@ int memory_failure(unsigned long pfn, int flags) } goto unlock_mutex; } else if (res < 0) { - res =3D action_result(pfn, MF_MSG_UNKNOWN, MF_IGNORED); + res =3D action_result(pfn, MF_MSG_GET_HWPOISON, MF_IGNORED); goto unlock_mutex; } } @@ -2363,7 +2391,7 @@ int memory_failure(unsigned long pfn, int flags) * Abort on fail: __filemap_remove_folio() assumes unmapped page. */ if (!hwpoison_user_mappings(folio, p, pfn, flags)) { - res =3D action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED); + res =3D action_result(pfn, MF_MSG_UNMAP_FAILED, MF_FAILED); goto unlock_page; } =20 --=20 2.39.3 From nobody Wed Feb 11 11:30:22 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 6904214A4E7 for ; Tue, 21 May 2024 23:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335756; cv=none; b=BOTJzG7hXY2GIz9+O2S3ryP2kDZF89OHNtcNeQ4v1ZK7/YDDFKlKJeqdc4oq9sl704PNAe/hp+su/SYU06hcwGIcp4lwL2wC80Dh/DaUkKM2d7dFtFG28P/kypgakve4RW0Lr43n/gj2XGiBMs5ljC9cxOCF9lwHzJs5TjW1nBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335756; c=relaxed/simple; bh=ihTcaZfF9lRkBEAHfa67ibCvGJNlg5fyNNR5cehumz4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ozxrsy0GoGgBWsQr9oIrKNTkhJUx2RdOB6SP78tYHgm2zYUW+TipUttqVV+VrlVLssznQlE0FjenLZxyD585EfE1adiv2yG1TdkMTRqFjeMxDAwC+JGOWsjNqeMhqKzcCH0OpbUGsjenPZZ7qR3M5nhrMdqcwwb5jYiypSU9O/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=h3CrhepT; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="h3CrhepT" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LJi8dZ025724; Tue, 21 May 2024 23:55:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=frA7aS1vLKTncyYL7L1DmGtD13xbXGlpWxyw+e4B7WM=; b=h3CrhepTNn/GaGgIJzZhqtsA7faeT1QZf89SKUeSOVcUQEJKLeokWgdytocXbQ/tR6wd mvdIHTnqEutpHvRGnRnDRNy0BeIXtqXtEbZ19zn0/AMebwZaz97AqmHJl6VA8GQ9RSTX pkUkL+cbnjeDIQ9wc72PTtUQeyieP/pbryXb98HMIJAmqNl+yM1zEXbTU2pRXuNfmKWU FPTPhJh4CglqeOBXb7DRzY9IM3xTiV1SHJRB6BybSR0VEj91El9FE9C8CCVzQpW2w7w1 ORy8M037XhGzohEkU3LnrD3PKhweG9vEWPfIaeaIiUMP5WMgGC7tBF7q/V3BPMrYnm8H 2g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6k466m2a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 23:55:40 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44LMZkKi002667; Tue, 21 May 2024 23:55:39 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3y6js8erce-5; Tue, 21 May 2024 23:55:39 +0000 From: Jane Chu To: linmiaohe@huawei.com, nao.horiguchi@gmail.com, akpm@linux-foundation.org, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/5] mm/memory-failure: move hwpoison_filter() higher up Date: Tue, 21 May 2024 17:54:28 -0600 Message-Id: <20240521235429.2368017-5-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240521235429.2368017-1-jane.chu@oracle.com> References: <20240521235429.2368017-1-jane.chu@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_14,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210182 X-Proofpoint-ORIG-GUID: fN-L7z8FkqKuAIhlYwvx_1gv1456QLzQ X-Proofpoint-GUID: fN-L7z8FkqKuAIhlYwvx_1gv1456QLzQ Content-Type: text/plain; charset="utf-8" Move hwpoison_filter() higher up as there is no need to spend a lot cycles only to find out later that the page is supposed to be skipped from hwpoison handling. Signed-off-by: Jane Chu Acked-by: Miaohe Lin Reviewed-by: Oscar Salvador --- mm/memory-failure.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 1e22d73c9329..794196951a04 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2301,6 +2301,18 @@ int memory_failure(unsigned long pfn, int flags) } =20 folio =3D page_folio(p); + + /* filter pages that are protected from hwpoison test by users */ + folio_lock(folio); + if (hwpoison_filter(p)) { + ClearPageHWPoison(p); + folio_unlock(folio); + folio_put(folio); + res =3D -EOPNOTSUPP; + goto unlock_mutex; + } + folio_unlock(folio); + if (folio_test_large(folio)) { /* * The flag must be set after the refcount is bumped @@ -2364,14 +2376,6 @@ int memory_failure(unsigned long pfn, int flags) */ page_flags =3D folio->flags; =20 - if (hwpoison_filter(p)) { - ClearPageHWPoison(p); - folio_unlock(folio); - folio_put(folio); - res =3D -EOPNOTSUPP; - goto unlock_mutex; - } - /* * __munlock_folio() may clear a writeback folio's LRU flag without * the folio lock. We need to wait for writeback completion for this --=20 2.39.3 From nobody Wed Feb 11 11:30:22 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 AC524149DEC for ; Tue, 21 May 2024 23:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335757; cv=none; b=CiGkIHBVdpcXZLo3wqdBRwod1yt+wThlyCalTuxTr3Q8Ni3tm+VLniG7uMHH9y3FhKkSCEBlu+Jgwf7/CrMAW568fsebE2Sq2Us9FzIAbmokBXXIDFI+gaDTcdAEIeZC8C4m3vTOolTGZmqmgFS+/IifTmqOkVpNm3MBywrImpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716335757; c=relaxed/simple; bh=Kc38EzOfeWAlb4bBoUH+4kvKqzdFABT2qnEca+zNUkg=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bfRUslqh914urf+xmn3CMS0rxyrRiJeSgiPZono/DotUgszxoPMAA8gd3dBqYyvf9x4Lz3gIeNkH5vc5aECWR22qNVc5q2RdoaLWmOg1qt+BEtDhvFNz+4mebQg9Wn7nnHNV77m4UPc+IHN4K9jxamg1BjlaHvQkl9ZmCgwxJqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=cIVRSMsq; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="cIVRSMsq" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LJi9Ws025744; Tue, 21 May 2024 23:55:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=I3L1LQIelw9oqT+0T41Q58pEC5gWfYbgn8T4h8gRVP4=; b=cIVRSMsqlLYYsVPR2FJWLHywyYr1y2WfWRRswKtAInrkSKhipcwyIHgLKtg5aCPx3weg 4/MikqcfOxA1ATOm9swY1+lkMIpxUz75w0nP6P5ImYo/RrVGREO6UMDCS8R7TPSbFnRf 8fVjE8ZNv6d73S00tKQeZZ3qnP4VREXyaznOoNR2OrLzSBNissq+dH2UqJYWEub8Q+Qn 1otMtmDfbAtipTA5aSl1oyPWfz1LaQdp2Ga/DMc7sIVCoX/2dyv+MMR3VBeeTAQvbgc7 79vOJtMhSKQjW6JFNFhr2k2tAYTmoozCsYCkl6OxIwUlQ3OqWFn8oMWe6KVVYV/DDPm8 0A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6k466m2c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 23:55:44 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44LMZkKk002667; Tue, 21 May 2024 23:55:43 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3y6js8erce-6; Tue, 21 May 2024 23:55:43 +0000 From: Jane Chu To: linmiaohe@huawei.com, nao.horiguchi@gmail.com, akpm@linux-foundation.org, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/5] mm/memory-failure: send SIGBUS in the event of thp split fail Date: Tue, 21 May 2024 17:54:29 -0600 Message-Id: <20240521235429.2368017-6-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240521235429.2368017-1-jane.chu@oracle.com> References: <20240521235429.2368017-1-jane.chu@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_14,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210182 X-Proofpoint-ORIG-GUID: 79GQpZ_jzEgc6Qmkdeqa_86YlEdLM5cy X-Proofpoint-GUID: 79GQpZ_jzEgc6Qmkdeqa_86YlEdLM5cy Content-Type: text/plain; charset="utf-8" While handling hwpoison in a THP page, it is possible that try_to_split_thp_page() fails. For example, when the THP page has been RDMA pinned. At this point, the kernel cannot isolate the poisoned THP page, all it could do is to send a SIGBUS to the user process with meaningful payload to give user-level recovery a chance. Signed-off-by: Jane Chu Acked-by: Miaohe Lin Reviewed-by: Oscar Salvador --- mm/memory-failure.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 794196951a04..a14d56e66902 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1706,7 +1706,12 @@ static int identify_page_state(unsigned long pfn, st= ruct page *p, return page_action(ps, p, pfn); } =20 -static int try_to_split_thp_page(struct page *page) +/* + * When 'release' is 'false', it means that if thp split has failed, + * there is still more to do, hence the page refcount we took earlier + * is still needed. + */ +static int try_to_split_thp_page(struct page *page, bool release) { int ret; =20 @@ -1714,7 +1719,7 @@ static int try_to_split_thp_page(struct page *page) ret =3D split_huge_page(page); unlock_page(page); =20 - if (unlikely(ret)) + if (ret && release) put_page(page); =20 return ret; @@ -2187,6 +2192,24 @@ static int memory_failure_dev_pagemap(unsigned long = pfn, int flags, return rc; } =20 +/* + * The calling condition is as such: thp split failed, page might have + * been RDMA pinned, not much can be done for recovery. + * But a SIGBUS should be delivered with vaddr provided so that the user + * application has a chance to recover. Also, application processes' + * election for MCE early killed will be honored. + */ +static int kill_procs_now(struct page *p, unsigned long pfn, int flags, + struct folio *folio) +{ + LIST_HEAD(tokill); + + collect_procs(folio, p, &tokill, flags & MF_ACTION_REQUIRED); + kill_procs(&tokill, true, pfn, flags); + + return -EHWPOISON; +} + /** * memory_failure - Handle memory failure of a page. * @pfn: Page Number of the corrupted page @@ -2328,8 +2351,10 @@ int memory_failure(unsigned long pfn, int flags) * page is a valid handlable page. */ folio_set_has_hwpoisoned(folio); - if (try_to_split_thp_page(p) < 0) { - res =3D action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); + if (try_to_split_thp_page(p, false) < 0) { + res =3D kill_procs_now(p, pfn, flags, folio); + put_page(p); + action_result(pfn, MF_MSG_UNSPLIT_THP, MF_FAILED); goto unlock_mutex; } VM_BUG_ON_PAGE(!page_count(p), p); @@ -2703,7 +2728,7 @@ static int soft_offline_in_use_page(struct page *page) }; =20 if (!huge && folio_test_large(folio)) { - if (try_to_split_thp_page(page)) { + if (try_to_split_thp_page(page, true)) { pr_info("soft offline: %#lx: thp split failed\n", pfn); return -EBUSY; } --=20 2.39.3