Re: [PATCH v10 07/13] x86/mm: Use physical address comparisons in fill_p*d/pte

From: Dave Hansen

Date: Mon Feb 23 2026 - 15:38:37 EST


On 2/4/26 11:20, Maciej Wieczor-Retman wrote:
> From: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
>
> Calculating page offset returns a pointer without a tag. When comparing
> the calculated offset to a tagged page pointer an error is raised
> because they are not equal.
>
> Change pointer comparisons to physical address comparisons as to avoid
> issues with tagged pointers that pointer arithmetic would create. Open
> code pte_offset_kernel(), pmd_offset(), pud_offset() and p4d_offset().
> Because one parameter is always zero and the rest of the function
> insides are enclosed inside __va(), removing that layer lowers the
> complexity of final assembly.

These are a little ugly, but it's better than defining three more
helpers that only get used once.

Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>