Re: [PATCH RFC 2/2] mm/x86/pat: Do proper PAT bit shift for large mappings

From: Dave Hansen
Date: Thu May 23 2024 - 23:30:30 EST


On 5/23/24 16:07, Peter Xu wrote:
> Probably not.. I think I can define a pgprot_to_large() globally, pointing
> that to pgprot_4k_2_large() on x86 and make the fallback to be noop. And
> if there's a new version I'll guarantee to run over my cross compilers.

I guess that would be functional, but it would be a bit mean to
everybody else.

> Any comments on the idea itself? Do we have a problem, or maybe I
> overlooked something?

I think it's probably unnecessary to inflict this particular x86-ism on
generic code. The arch-generic 'prot' should have PAT at its 4k
(_PAGE_BIT_PAT) position and then p*d_mkhuge() can shift it into the
_PAGE_BIT_PAT_LARGE spot.