From nobody Sun Dec 14 12:02:53 2025 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 3A3E27C083 for ; Fri, 24 May 2024 21:53:26 +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=1716587609; cv=none; b=NOCOBoSXbmqjK5qQfGg9+h5z2s81+C3tbD4mNInzruViLwCSWKHaVNBrQ5INbXs7m4GbKw7FoDvtfAMCWYBxVce217cbgZxAwWXOEwNM/FHF47na4EJp436BGgPMyfxwh0EdrdfnK38vGV405Grl1NHo2CAT+PT6t3q27Yj8hAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716587609; c=relaxed/simple; bh=xR/G2YwzoliqJGu1LnJE7SfCRlqGE6/LuzyY4cSKnBI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rcOe5MuJ5sEjLv7RScDFwg7WqUY7fyFYAQmRSOpANQdr1353pbI3ldV+MSllotE8OJJs9yvFwlj/j1H2hnRwREY/v0yPQfS1i9d2qYgcyaE1MCN3QnQoYDo2RbdXvvDwgixVP72WJJoBR9uNPTEjfZlOeQiUgnfw2L8HoqfoV9s= 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=TdcJBpGr; 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="TdcJBpGr" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44OFxjhF015807; Fri, 24 May 2024 21:53:14 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=TdcJBpGrNn3qNkMVnilcUOPTUhxoR9n7n423lwhS5dNLcFnxh/pfSDcXomK4xUAAhiVX wP16N+QrVrskqaU3hspLv/12qFhlJuv6yPMsvpV+ttDjIBK9ICbqduZY7Gy5v2rvAIzq z/XnRrIIEl6fT588jno8RVTyxteuGWRg5RfLxAuRuluE9pf+8pFjHnkqNzNOEtwY9/T/ 8xKDCf0hmOW7HMqnejHg1y2haNxqOWSatRApVgawilJbqXdcH/x+Mscnb+u+A9qnEd78 YP+x++oJOdx5JMQ25xDlKuygN9UcKzsbGEOQHHvkBG+VyRvAhkZPvaxI0+z3pWo5nqjQ BA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6k8ddd00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2024 21:53:14 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44OLjG18035956; Fri, 24 May 2024 21:53:13 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3y6jscbsu0-2; Fri, 24 May 2024 21:53:13 +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 v4 1/5] mm/memory-failure: try to send SIGBUS even if unmap failed Date: Fri, 24 May 2024 15:53:02 -0600 Message-Id: <20240524215306.2705454-2-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240524215306.2705454-1-jane.chu@oracle.com> References: <20240524215306.2705454-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-24_08,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405240157 X-Proofpoint-GUID: FZtvSnJWRGZRRG_af1fn4jAKDaVUcprt X-Proofpoint-ORIG-GUID: FZtvSnJWRGZRRG_af1fn4jAKDaVUcprt 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 Sun Dec 14 12:02:53 2025 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 3C2648612E for ; Fri, 24 May 2024 21:53:28 +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=1716587610; cv=none; b=j741K8klozwvAuAc3MDcUuRSiT5pEb1ZfgcUJSI8UtIxkgZUde3wTcA59IkaF9P3ozzwCZfOGmU5yTx50jk2F6BZnwj76j18jTVhkC+7KGSyVf9w7k60iAz/8sKzlpN0qGgt6sXCD8kCYrMsI8VbfU1RMHSHrCLtAsxuE+AI68w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716587610; c=relaxed/simple; bh=mT+QH+hU8g5l3Zv5v9XCenrx59MVtbIUnXCOz0uw8J4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oFjlvcY6KTjutFX0uI60j2Gh5DdR11K8/mCeThOvCVq2Ro3TGlrYDpe3RT8+g/USH1qObWKKTofRG2by3rZH1fWVJaOlscfY723adM3smlA1Z/1jVzDfRQTzkWEkWqjWUSPdaeG7UeEvGWXZdlHi3/+XAoP9qu4L9jk5gkhWwfE= 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=BljuSLIh; 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="BljuSLIh" 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 44OIC2G4010959; Fri, 24 May 2024 21:53:16 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=fT0mhbFhuyfEQ6ht8rgkYeHmF9I9tk49P2eL39tTz8s=; b=BljuSLIhlHGj7+LZ9Fli7rwBFZcnSBIe7v8KKY5KV9Egm878l/J+VHH1xWXi8MoITsjp kT67s5ZBWYovpiWSkPQxGbIwGh+5yy25XDlcrS7IqgZ9tN0mFrep4btWoUP617Ak5UwF sTEf1cmEmBTiT8VL57c+SmsN5qxe07nReb5HNVL5rwTPrbgy0wl/Ttqd6Z8n06tl1pVH HdzgUAqITKS24dJjoA79lJp1QDcgdImTdegcU//MdKMPwvcgJP/0B0onuBIUPpJovgzX pz9xGdxlLjYOQDg+Can6zxaztk9PTsD2n/ASTnnqIZl4vJeJO5E5vl1qonSnInCZDOij 6w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6jx2n8wy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2024 21:53:16 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44OLjG1A035956; Fri, 24 May 2024 21:53:15 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3y6jscbsu0-3; Fri, 24 May 2024 21:53:15 +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 v4 2/5] mm/madvise: Add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON) Date: Fri, 24 May 2024 15:53:03 -0600 Message-Id: <20240524215306.2705454-3-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240524215306.2705454-1-jane.chu@oracle.com> References: <20240524215306.2705454-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-24_08,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405240157 X-Proofpoint-GUID: 7grlyNM4N9_MwCVNy18sOMTXeKd1BPaf X-Proofpoint-ORIG-GUID: 7grlyNM4N9_MwCVNy18sOMTXeKd1BPaf 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 Sun Dec 14 12:02:53 2025 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 A000750263 for ; Fri, 24 May 2024 21:53:53 +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=1716587635; cv=none; b=JiefFhVpV/kagcEu9YifZJ0Zj53zpr2GhkYp6b84RsAVQYcmYMpnw3KXpTIm3TkujRJV5NCmwWtvbWezKsCYXkjoghyRkuA8OJibAiA/Ur9myFvWZUg5rp8uYba5j04XNnmnJOiOiBGWHkrYaVM1r7417DfyJSuaCPev1TP+zBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716587635; c=relaxed/simple; bh=D7kXXmKbXqjGmHdN4mg/BtutHXoSCD6re2jm29C5YuY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uKbIxgpBeX5F2JbyNIgYcLjZRg+O1edNQQDJPZgGx0Bvew1EZeCiqECC5CLpP8YuBkiSoG/xuX65RGY4+XWJydXSuqGnnUw+7S58uNe557Oj9ri7XZ0kcDcqfUK0jPx+7v3goXzhLMFFGAwSoXI3qsxPzzDVblKCBGcZywPINFE= 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=f0IW7CgH; 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="f0IW7CgH" 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 44OFx1PV020088; Fri, 24 May 2024 21:53: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=7HYN1EpHhN8K7/QWXfhCO5Xkdz0SMhL/TG8r2CsGXTY=; b=f0IW7CgHhxEM/jkAAr9fsWvW80EjOTg3U1E+Aunb7J/MnOxa8mzWmn5h8o+z36Ougs1R j7mySjed4aSn7Gj2WGdbKGKSDbyeUBeIJPMJ1ixkjbIe8AMwpxH1cQEhQ3bdjQk285MI uMCFag5BEhdMzWUituxLxLmpPr7qXrV9fkXyHeB+Foy19xBnGYm4LsWk9yYW0ljxREXl Y4I54CbIY1NB2m7nngKDmzJWwmnDIOwrrm1CSQTb1aV5ZGkysrq2rit8nPt3+aIpAWlj AKFIg9WwBL26PdNS9zBStJOBfx6FuwC7d08Zspm4khQP5eFIJbH1BGH8975OJFIIXm2l QQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6mce5h56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2024 21:53:43 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44OLjG1C035956; Fri, 24 May 2024 21:53:42 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3y6jscbsu0-4; Fri, 24 May 2024 21:53:42 +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 v4 3/5] mm/memory-failure: improve memory failure action_result messages Date: Fri, 24 May 2024 15:53:04 -0600 Message-Id: <20240524215306.2705454-4-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240524215306.2705454-1-jane.chu@oracle.com> References: <20240524215306.2705454-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-24_08,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=940 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405240158 X-Proofpoint-ORIG-GUID: _mdySqjhmz_UPwiin9TJeXbOJ1k2kgS6 X-Proofpoint-GUID: _mdySqjhmz_UPwiin9TJeXbOJ1k2kgS6 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 Reviewed-by: Oscar Salvador Acked-by: Miaohe Lin --- include/linux/mm.h | 2 ++ include/ras/ras_event.h | 2 ++ mm/memory-failure.c | 37 ++++++++++++++++++++++++++++++++----- 3 files changed, 36 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..d1fb1d6f6b11 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 may 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, and is removed from the 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,7 @@ 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; } else if (res =3D=3D -EBUSY) { @@ -2062,7 +2088,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 +2123,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 +2257,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 +2294,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 +2390,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 Sun Dec 14 12:02:53 2025 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 23DBF8612E for ; Fri, 24 May 2024 21:53:57 +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=1716587639; cv=none; b=VGeymSiQrsGG19Q9Kga6rvW8fqApR+hv11En5217oxLpG+EvWCSLxc2rlcyQiQFKnzbe5D3A+dDfN0dB/KM6H8XILjPhjxgUTxkiIlr45UqcMl5a28ad2/EcmnOZMmzFy9D8Fxs0/gzDYOfG9pqRxlKA3NO3F/wLNE0S6gUH/1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716587639; c=relaxed/simple; bh=u+F3kkTCsexw6gGbJjFN/h7di0MuMht4yskvMifGQnc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KH6nrTEcHqbQiULP6e9tYQLWljMVIRO1joAItFAE9KNmkJ1IqSCd9Hb0BdbEWoYBkcmz3m1NoVAOYN8wUyhN2ersgI7vYB/fwHTpiLF6mmzaVUfmQjwhn7TXy+OhAw2V477qrVPm9OugE05IGknAJrPr4ztchmQoF60fnSjVoNk= 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=KW8Qwaw9; 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="KW8Qwaw9" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44OKTbZh023819; Fri, 24 May 2024 21:53:48 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=SihancN5k8LC/Hgj/5KOjJmpYjhXQMOG14zedpZ75B8=; b=KW8Qwaw9MgRTg2x6HgWx4L/6ultVBxcZu1IHaepybohYvCDch5isMwzqEapu2CteSb41 KWsxMyoAa4IVCIzA3xHEdbiU/p+B0JNiK28ssP9KL1at9eBlEDlu9VQvIIPEV71Fe9tl paGzZjvKEZdH3GGMsFwvJI92QFHNMWlBqWjF+krfNuSlKwU/K20kV/2/DaWde3jORtEO tgndbaquKNWUHvyVk4U0GJOw9aDiQFSK6IoxCMC10njzgNpoESMeyt7brQPHCjwIorpk ndpalrOF/jweatfkpifBeTuvSXR0REwwlGLeLTp2455ym1GMtO9lc9Rf0X8ORikqiLFO Bw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6m7bcxts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2024 21:53:48 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44OLjG1O035956; Fri, 24 May 2024 21:53:47 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3y6jscbsu0-5; Fri, 24 May 2024 21:53:47 +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 v4 4/5] mm/memory-failure: move hwpoison_filter() higher up Date: Fri, 24 May 2024 15:53:05 -0600 Message-Id: <20240524215306.2705454-5-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240524215306.2705454-1-jane.chu@oracle.com> References: <20240524215306.2705454-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-24_08,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405240158 X-Proofpoint-ORIG-GUID: OTsiOAKLEUfSAJALl24pXDTKjX6cQFx5 X-Proofpoint-GUID: OTsiOAKLEUfSAJALl24pXDTKjX6cQFx5 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 Reviewed-by: Oscar Salvador Acked-by: Miaohe Lin --- 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 d1fb1d6f6b11..85659dd0ea32 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2300,6 +2300,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 @@ -2363,14 +2375,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 Sun Dec 14 12:02:53 2025 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 CE9D0126F2A for ; Fri, 24 May 2024 21:53:58 +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=1716587640; cv=none; b=Tovma6tk/hsaWgCKIHsuYYIBSP7HtAA5rkd94f5CvHy8hmBHTuu/WCPUduBWxhtcnOSkH9naT/HJv7LxEhB4aJkgp39MsZBswrm+lpWNob4fmIHdQobSjOIvFK0rxvgO3HLS+yrOYF82aEZUFTX3Jx+fzk2pJe/+rd+Nc6zGles= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716587640; c=relaxed/simple; bh=a/Hlm8C/sajEH5HK6MNoXK+XCedLERs9NZBp9DNex2c=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fUahLEHkBLJAuWFa1fO+O6Yhjp7p9GuW3RWnthVP6dcFPeRsuKtv5cYQ6dGgrQupxpsLv3Q2wlkTN3RxbilTe129RJWBiFAi0BrlRd5k7bTRD7LCnw+53ERFHvdLcBzSUz/LRJUe/Awuk+u0dApeaIkkM3r3s025vUOU6SeaRIw= 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=lYxXVGvI; 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="lYxXVGvI" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44OHcEG8021717; Fri, 24 May 2024 21:53:51 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=NItRoZidtl5jZFk2E3c9bRVzuOiNACCqAvB+zCVBjYM=; b=lYxXVGvInCRrVClVw+SA1gLS/PoZSLuThuPH2VElXUrdvyUuoUBAjy9MpgU6YzWceXem BZbTLq1JzVtnDMGh6Uh7mTdNen0dxTm8UUbCdQJAYXIaP3yd5zN6XyZ+ngfrMoAE6WOF KWRl1cKdzdZAihheh+6KJSVT5CTtnwNWg1tLBaZTXw69Fqqiozft4SWpyJH+rER00ZSb 2b9tOmhozHoN9sEHi6gCCWEfVPjFto+TkY4Ja4x2K5laurVTgs0/19bHk5bVjOmupBSQ RjuNJwWEn6CJlXSSQVTmrC4tHvyaMbK1bKokqG6Aya5gJJNurZAMxygDOTuEvYQVTePE yA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6k8ddd0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2024 21:53:50 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44OLjG1Q035956; Fri, 24 May 2024 21:53:50 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3y6jscbsu0-6; Fri, 24 May 2024 21:53:49 +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 v4 5/5] mm/memory-failure: send SIGBUS in the event of thp split fail Date: Fri, 24 May 2024 15:53:06 -0600 Message-Id: <20240524215306.2705454-6-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240524215306.2705454-1-jane.chu@oracle.com> References: <20240524215306.2705454-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-24_08,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405240158 X-Proofpoint-GUID: hPXbkI42xBQJuar7JkbK3Zr9qXE31038 X-Proofpoint-ORIG-GUID: hPXbkI42xBQJuar7JkbK3Zr9qXE31038 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 Reviewed-by: Oscar Salvador Acked-by: Miaohe Lin --- mm/memory-failure.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 85659dd0ea32..dcca7297a94c 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; @@ -2186,6 +2191,22 @@ 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 void 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); +} + /** * memory_failure - Handle memory failure of a page. * @pfn: Page Number of the corrupted page @@ -2327,8 +2348,11 @@ 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 -EHWPOISON; + 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); @@ -2702,7 +2726,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