From: David Hildenbrand <david@redhat.com>
To: Andrew Zaborowski <balrogg@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Miaohe Lin <linmiaohe@huawei.com>
Subject: Re: [PATCH] mm: avoid poison consumption when splitting THP
Date: Thu, 11 Sep 2025 10:12:48 +0200 [thread overview]
Message-ID: <c88a263e-a73e-430a-bfb9-a2b9a32dede8@redhat.com> (raw)
In-Reply-To: <20250911021401.734817-1-balrogg+code@gmail.com>
On 11.09.25 04:14, Andrew Zaborowski wrote:
> Handling a memory failure pointing inside a huge page requires splitting
> the page. The splitting logic uses a mechanism, implemented in
> migrate.c:try_to_map_unused_to_zeropage(), that inspects contents of
> individual pages to find zero-filled pages. The read access to the
> contents may cause a new, synchronous exception like an x86 Machine
> Check, delivered before the initial memory_failure() finishes, ending
> in a crash.
>
> Luckily memory_failure() already sets the has_hwpoisoned flag on the
> folio right before try_to_split_thp_page(). Don't enable the shared
> zeropage mechanism (RMP_USE_SHARED_ZEROPAGE flag) down in
> __split_unmapped_folio() when the original folio has has_hwpoisoned.
>
> Note: we're disabling a potentially useful feature, some of the
> individual pages that aren't poisoned might be zero-filled. One
> argument for not trying to add a mechanism to maybe re-scan them later,
> apart from code cost, is that the owning process is likely being
> killed and the memory released.
>
> Signed-off-by: Andrew Zaborowski <balrogg+code@gmail.com>
> ---
I would suggest just checking whether the page (PageHWPoison()) is
poisoned before doing the check for zero. If set, just treat it as non-zero.
No need to stop the split.
You'll have to do that in two locations.
No need to mess with RMP_USE_SHARED_ZEROPAGE
--
Cheers
David / dhildenb
prev parent reply other threads:[~2025-09-11 8:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 2:14 Andrew Zaborowski
2025-09-11 3:19 ` Zi Yan
2025-09-11 6:19 ` Lance Yang
2025-09-11 8:12 ` David Hildenbrand [this message]
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=c88a263e-a73e-430a-bfb9-a2b9a32dede8@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=balrogg@gmail.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
/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