Re: [PATCH 07/11] mm: Drop fake head checks and fix a race condition

From: Kiryl Shutsemau
Date: Mon Dec 08 2025 - 05:48:55 EST


On Sat, Dec 06, 2025 at 05:27:29PM +0000, Usama Arif wrote:
>
>
> On 05/12/2025 19:43, Kiryl Shutsemau wrote:
> > Fake heads are no longer in use, so checks for them should be removed.
> >
> > It simplifies compound_head() and page_ref_add_unless() substantially.
> >
>
> Would be good to mention in the commit message what the race condition is as
> its there in the subject. Probably can copy some text from the cover letter.

I forgot to update subject for the patch.

Yes, there's a race window in page_fixed_fake_head() between checking
PG_head and checking compound_info/head in the first tail page.

But the race seems to be harmless.

Unlike the race in 1d798ca3f164 ("mm: make compound_head() robust") the
caller always gets valid pointer to a struct page. It might not belong
to the same compound page anymore if the caller doesn't hold reference
for the page. But it shouldn't be a news for speculative page lookup
path. Caller would need to re-check the page after obtaining reference
anyway.

I will drop "and fix a race condition".

--
Kiryl Shutsemau / Kirill A. Shutemov