From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (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 0FB311C860C; Fri, 24 Oct 2025 02:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761271725; cv=none; b=CAnlbzvJdGAGJq7j92rBkptXYjbjJuxFBJ219pISQBoRtPQHDtLl/adXDUPDGJ5mxWugA40nc6ZgkJt/KrgzZh/e4JUGytNWLdlo/YXGDbCuefuSgClMeD33gP2NXv93Wy/6F7V2vOUzYg5fyQI2PxAz3Dr1NswJHmo1i12HqKM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761271725; c=relaxed/simple; bh=CCwFEhSOfS9NSfGrVzU2gOVUH5aKq2aEZss7tEoO70M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DXUA/TixKV+ZZy8a46l9bejEAXreN1CFX+psps/rfc1xrTszCFUtmg8VW11I7ER5a5GVqCBAxSHAYSnEoI/GyDluk/YHHx2SmUIwG2sqbfbwaUDlGBvrLNrb15LKHK9GQLccOSmXVLESDdTeVM9N4hpNgTdlAMVwYyoPwOfMU68= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=vnECX4a6; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="vnECX4a6" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1761271714; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=9JVQ7GVWcIU2eIV2pPNnWqg43ppy0VbXuD3FPTad8F8=; b=vnECX4a6XkGY0myW4ggcQfPzYwVGI8it2z4e9NTKYtc7WI8CUx+QA5xg5M5iqVtwNSO8CnmlZzvDzwV6wHvYIIwdlbjedysbvn0Ljz3xL1A2qwG3kYM3NtyahzBWVGPrHwvujPIAeEIs2qI/jJ0FGkgigUw3mrtx6GKOfvuK+i4= Received: from 30.74.144.122(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WqscYCq_1761271712 cluster:ay36) by smtp.aliyun-inc.com; Fri, 24 Oct 2025 10:08:32 +0800 Message-ID: Date: Fri, 24 Oct 2025 10:08:31 +0800 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order To: Zi Yan , linmiaohe@huawei.com, david@redhat.com, jane.chu@oracle.com Cc: kernel@pankajraghav.com, akpm@linux-foundation.org, mcgrof@kernel.org, nao.horiguchi@gmail.com, Lorenzo Stoakes , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , "Matthew Wilcox (Oracle)" , Wei Yang , Yang Shi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org References: <20251023030521.473097-1-ziy@nvidia.com> From: Baolin Wang In-Reply-To: <20251023030521.473097-1-ziy@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > --- LGTM. Reviewed-by: Baolin Wang