From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 004E12FB091; Fri, 24 Oct 2025 07:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761291856; cv=none; b=rSLddcsiVTU1MJAtWkbu8Wgo2h2mECYROkQil3mH5SPqMZgIct/b4DaDVayOmOBmkUFoB2y3xY7ZeBT6VdgaVijVTE/EJKElJHI7dVsLNOPEodQWk5AjUmEot8Qi3DcX3wxhUKOAVFIDnLc1Wde01TmwOPFMBI2O4+w+chiBYIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761291856; c=relaxed/simple; bh=8q3BodeZt7lgHPjebyaAnrcmLqOAj1I2FXahupw8yf0=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=et4Fu7D+3WRMLZMGfJQ8deO9oxefQtjwBm5pg6yHik9bev30SwglgPnppOoI5ZOP8wloqLk/QA97juV5AsMCrvQlYGMpoRFB8NRkb9fz41Y9EHPZZIosbHRwotJYc8W5xLeWWk8Yq7A8BNNSYWHJ4LHoh2cqqPIcZl1uPZUOTk0= 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; arc=none smtp.client-ip=45.249.212.188 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.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4ctFCf6wB6zTh71; Fri, 24 Oct 2025 15:39:26 +0800 (CST) Received: from dggemv706-chm.china.huawei.com (unknown [10.3.19.33]) by mail.maildlp.com (Postfix) with ESMTPS id 02B23180B62; Fri, 24 Oct 2025 15:44:10 +0800 (CST) Received: from kwepemq500010.china.huawei.com (7.202.194.235) by dggemv706-chm.china.huawei.com (10.3.19.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 24 Oct 2025 15:44:09 +0800 Received: from [10.173.125.37] (10.173.125.37) 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; Fri, 24 Oct 2025 15:44:08 +0800 Subject: Re: [PATCH v4] mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order To: Zi Yan CC: , , , , Lorenzo Stoakes , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , "Matthew Wilcox (Oracle)" , Wei Yang , "Yang Shi" , , , , , , References: <20251023030521.473097-1-ziy@nvidia.com> From: Miaohe Lin Message-ID: <479c9b79-a8a3-6e14-9264-cda3e9851b43@huawei.com> Date: Fri, 24 Oct 2025 15:44:07 +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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20251023030521.473097-1-ziy@nvidia.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 2025/10/23 11:05, Zi Yan wrote: > folio split clears PG_has_hwpoisoned, but the flag should be preserved in > after-split folios containing pages with PG_hwpoisoned flag if the folio is > split to >0 order folios. Scan all pages in a to-be-split folio to > determine which after-split folios need the flag. > > An alternatives is to change PG_has_hwpoisoned to PG_maybe_hwpoisoned to > avoid the scan and set it on all after-split folios, but resulting false > positive has undesirable negative impact. To remove false positive, caller > of folio_test_has_hwpoisoned() and folio_contain_hwpoisoned_page() needs to > do the scan. That might be causing a hassle for current and future callers > and more costly than doing the scan in the split code. More details are > discussed in [1]. > > This issue can be exposed via: > 1. splitting a has_hwpoisoned folio to >0 order from debugfs interface; > 2. truncating part of a has_hwpoisoned folio in > truncate_inode_partial_folio(). > > And later accesses to a hwpoisoned page could be possible due to the > missing has_hwpoisoned folio flag. This will lead to MCE errors. > > Link: https://lore.kernel.org/all/CAHbLzkoOZm0PXxE9qwtF4gKR=cpRXrSrJ9V9Pm2DJexs985q4g@mail.gmail.com/ [1] > Fixes: c010d47f107f ("mm: thp: split huge page to any lower order pages") > Cc: stable@vger.kernel.org > Signed-off-by: Zi Yan Thanks for your patch. LGTM. Reviewed-by: Miaohe Lin Thanks. .