From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 D31662556E for ; Fri, 24 Oct 2025 08:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761294723; cv=none; b=dSYFcO0JLABgp40JBlGzmDHq6k6+gQnXwL4JeihVXJWUZlCs9eb0ydgmtXR2ggctJZ5itePKKOiaNLF8jmaLyeqMlX6WhLn9KCCx7rG8f/7eaMOS8pw5kHZ7tZyvfxNMNBlR3DkNKCiaF5hLcosazJjI6j5ZRawkZxa0qtC1dpU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761294723; c=relaxed/simple; bh=NaTHKjX5/F0/7DNjhiX7M1FaUcHmFlF9KmUUji5FGQA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ehHHOCojs15ixjWSy/nOLze2eTqUdVMGnGNB+gnIIbFngaUVd3b+vjUaedgSiTvXLnUKBK/OKixTNZ94XtzwRo/ObRpnMHwVHqvCom4dHGEHK4cs2dYS4ZNtaTvl9r1n0rqmEM+nWUaOxUdo7M0k/dKpUMlQBR4caZgqNOfk7uE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=VZQ8BcqV; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="VZQ8BcqV" Message-ID: <44310717-347c-4ede-ad31-c6d375a449b9@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1761294708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=que4oKIU2Y9paKeWcPbyLqkBz0QggtLbLzwslhxaSPI=; b=VZQ8BcqVSWjZY2iooCLrZafVjkiidx7JhlHaZvyQe4SfVPp2KDJ6V6C0JsD/uvctrakrus xbl8zcgGoAGL9fGd/v8Ihz5Cq3/ZzncmdV7575MlndUnq6/G6FESI40c7xsoFbUyVa/MAo bnJ5ksjpU60HpmsyvkIVn1tOhj6UF+k= Date: Fri, 24 Oct 2025 16:31:30 +0800 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v4] mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order To: Zi Yan Cc: kernel@pankajraghav.com, akpm@linux-foundation.org, mcgrof@kernel.org, nao.horiguchi@gmail.com, Lorenzo Stoakes , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , "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, linmiaohe@huawei.com, david@redhat.com, jane.chu@oracle.com References: <20251023030521.473097-1-ziy@nvidia.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <20251023030521.473097-1-ziy@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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 > --- Good spot! LGTM, feel free to add: Reviewed-by: Lance Yang