On 2026/6/11 21:20, David Hildenbrand (Arm) wrote: > On 6/11/26 09:36, Miaohe Lin wrote: >> On 2026/6/11 13:43, Michael S. Tsirkin wrote: >>> On Thu, Jun 11, 2026 at 11:35:36AM +0800, Miaohe Lin wrote: >>>> >>>> Do you mean repeating SetPageHWPoison on every branch? >>> >>> Right. >>> >>>> Is it possible >>>> to make __free_pages_prepare changes page->flags atomically or this race >>>> is specified to memory_failure? >>>> >>>> Thanks. >>>> . >>> >>> >>> Adding an atomic op on every fast path page allocation is, I am >>> guessing, going to slow down Linux measureably. >>> >>> Doing it for the benefit of memory_failure, which is the slowest of >>> slow paths, seems unpalatable, to me. >> >> Agree, it's not worth to do so. >> >>> >>> Neither am I sure it's the only racy place - >>> grep for __SetPage and __ClearPage - all these have the same issue, I >>> suspect. >>> >>> At the same time, I'm not an mm maintainer. If you disagree, try to >>> upstream a change converting all non atomics in mm to atomics, and see >>> what others say. >> >> Since memory_failure might be the only place, this change would be >> unacceptable. >> We should come up with a better solution. Maybe we can try repeating >> SetPageHWPoison >> and ClearPageHWPoison at a first attempt though it looks somewhat weird to >> me and makes >> code more complicated. > > And I am fairly sure we could still have some remaining races ... it's shaky.
I have to agree it's shaky. Any suggestion for next step? Thanks. .

