Re: [PATCHv6 12/17] mm: Drop fake head checks

David Hildenbrand (Arm)
2026-02-06T09:41:52Z

On 2/2/26 16:56, Kiryl Shutsemau wrote:
> 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;
>
> This substantially simplifies compound_head() and page_ref_add_unless(),
> removing both branches and RCU overhead from these hot paths.

Can you say a bit words more why RCU was required and is now no longer
needed?

IIRC, it's because we now no longer reuse the real head page (page 0)
for a tail, and there could have been a race where we could have
attempted to write to that page0 while already mapped (r/o) to page1.

Also good to mention that the corresponding RCU sync will be removed
separately in a following commit.

Nothing jumped at me and it's a great simplification for core-mm.

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

--
Cheers,

David