linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Pankaj Raghav <kernel@pankajraghav.com>
Cc: linmiaohe@huawei.com, david@redhat.com, jane.chu@oracle.com,
	akpm@linux-foundation.org, mcgrof@kernel.org,
	nao.horiguchi@gmail.com,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Nico Pache <npache@redhat.com>,
	Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
	Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Wei Yang <richard.weiyang@gmail.com>,
	Yang Shi <shy828301@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, stable@vger.kernel.org
Subject: Re: [PATCH v4] mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order
Date: Thu, 23 Oct 2025 13:20:40 -0400	[thread overview]
Message-ID: <B60BDD1F-EABF-47D2-9FA5-146B53C2A304@nvidia.com> (raw)
In-Reply-To: <d0362c9d-67f9-4ea5-a5c1-792f960da70b@pankajraghav.com>

On 23 Oct 2025, at 7:10, Pankaj Raghav wrote:

> On 10/23/25 05: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;
>
> Is it easy to add a selftest in split_huge_page_test for this scenario?

Probably, but I prefer to do this in a separate memory failure test.
I think the steps are:
0. set up a SIGBUS handler,
1. get a XFS image, like split_huge_page_test does,
2. set block size > page size,
3. fault in a large folio bigger than block size,
4. madvise(MADV_HWPOISON),
5. catch SIGBUS since the folio cannot be split to order-0 and check
   the corresponding folio's has_hwpoison flag.

I will put this on my TODO list.

>
>> 2. truncating part of a has_hwpoisoned folio in
>>    truncate_inode_partial_folio().
>>
> --
> Pankaj


--
Best Regards,
Yan, Zi


  reply	other threads:[~2025-10-23 17:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23  3:05 Zi Yan
2025-10-23  7:22 ` David Hildenbrand
2025-10-23 11:10 ` Pankaj Raghav
2025-10-23 17:20   ` Zi Yan [this message]
2025-10-23 17:40 ` Yang Shi
2025-10-24  2:08 ` Baolin Wang
2025-10-24  7:44 ` Miaohe Lin
2025-10-24  8:31 ` Lance Yang
2025-10-24 15:44 ` Lorenzo Stoakes
2025-10-25 15:30   ` Zi Yan
2025-10-27 15:31     ` Lorenzo Stoakes
2025-10-31  2:19 ` Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B60BDD1F-EABF-47D2-9FA5-146B53C2A304@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=dev.jain@arm.com \
    --cc=jane.chu@oracle.com \
    --cc=kernel@pankajraghav.com \
    --cc=lance.yang@linux.dev \
    --cc=linmiaohe@huawei.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mcgrof@kernel.org \
    --cc=nao.horiguchi@gmail.com \
    --cc=npache@redhat.com \
    --cc=richard.weiyang@gmail.com \
    --cc=ryan.roberts@arm.com \
    --cc=shy828301@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox