[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c88a263e-a73e-430a-bfb9-a2b9a32dede8@redhat.com>
Date: Thu, 11 Sep 2025 10:12:48 +0200
From: David Hildenbrand <david@...hat.com>
To: Andrew Zaborowski <balrogg@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Miaohe Lin <linmiaohe@...wei.com>
Subject: Re: [PATCH] mm: avoid poison consumption when splitting THP
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@...il.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
Powered by blists - more mailing lists