Re: [PATCHv7 13/18] mm: Drop fake head checks

From: David Hildenbrand (Arm)

Date: Mon Oct 26 2026 - 17:11:43 EST


On 2/27/26 20:42, Kiryl Shutsemau (Meta) wrote:
> From: Kiryl Shutsemau <kas@xxxxxxxxxx>
>
> With fake head pages eliminated in the previous commit, remove the
> supporting infrastructure:
>
> - page_fixed_fake_head(): no longer needed to detect fake heads;
> - page_is_fake_head(): no longer needed;
> - page_count_writable(): no longer needed for RCU protection;
> - RCU read_lock in page_ref_add_unless(): no longer needed;

I have an AI report that removing RCU read-lock was wrong.

The sequence is trivial:

1) read() -> .... page_ref_add_unless_zero() -> atomic_add_unless()

int c = raw_atomic_read(v);

do {
if (unlikely(c == u))
break;

We pass that check. Then we sleep (rescheduled, vcpu rescheduled etc)

2) Page gets freed

3) Huge page gets allocated and HVO makes the struct page read-only.

4) 1) continues

} while (!raw_atomic_try_cmpxchg(v, &c, c + a));


Then we try to write to a memmap that has been optimized by HVO and is read-only.

Apparently easy to reproduce by adding a delay before the cmpxchg().


The AI fix I received alongside the report is obviously complete garbage (as it
causes severe overhead on all fronts) and I am going to spare you from it.

Can you look into it?

--
Cheers,

David