Re: [PATCHv6 15/17] mm: Remove the branch from compound_head()

From: Vlastimil Babka

Date: Tue Feb 10 2026 - 11:42:29 EST


On 2/2/26 16:56, Kiryl Shutsemau wrote:
> The compound_head() function is a hot path. For example, the zap path
> calls it for every leaf page table entry.
>
> Rewrite the helper function in a branchless manner to eliminate the risk
> of CPU branch misprediction.
>
> Signed-off-by: Kiryl Shutsemau <kas@xxxxxxxxxx>
> Reviewed-by: Muchun Song <muchun.song@xxxxxxxxx>
> Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>

Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>