Re: [PATCH 1/2] mm/compaction: skip folios containing hwpoisoned pages
From: David Hildenbrand (Arm)
Date: Tue Oct 20 2026 - 10:13:02 EST
On 10/20/26 15:31, Kaitao Cheng wrote:
>
>
> 在 2026/10/20 21:07, David Hildenbrand (Arm) 写道:
>> On 10/20/26 13:27, Kaitao Cheng wrote:
>>>
>>>
>>> 在 2026/10/11 21:14, Huang, Ying 写道:
>>>
>>> On architectures with hardware error correction and exception recovery
>>> support, accessing faulty memory automatically triggers an exception,
>>> which itself guarantees atomicity.
>>>
>>> On architectures without such support, even if we implement this logic
>>> in copy_mc_user_highpage() and copy_mc_highpage(), checking the hwpoison
>>> flag and copying the data remain two separate operations. They cannot
>>> be performed atomically, so there is still a race window between them,
>>> however small.
>>
>> Yes. And you need proper architecture support to fix it?
>
> It does require architecture support, but that doesn't seem practical, haha.
Well, but that's required when an arch wants to rule out all races.
>
>>> Moving the hwpoison check after the copy might address this issue.
>>> Is there anything wrong with my understanding?
>>
>> Will architectures that are not prepared for copy_mc_user_highpage() not simply
>> crash if they trigger an MCE during an access?
>>
>
> Do we need to check both before and after the copy? This feels a bit
> redundant, and I'm not sure whether such a small race window warrants
> an additional check.
>
I don't see how checking after the copy makes any sense? :)
You already crashed if there was a problem, why check? Or what am I missing?
--
Cheers,
David