Re: [PATCH] arch,x86: Skip setting align_offset for hugetlb mappings

From: Oscar Salvador (SUSE)

Date: Tue Jun 02 2026 - 01:04:28 EST


On Mon, Jun 01, 2026 at 01:25:12PM -0700, Dave Hansen wrote:
> On 6/1/26 05:50, Oscar Salvador wrote:
> > On x86, arch_get_unmapped_area{_topdown} set align_offset in order to avoid
> > cache aliasing on I$ on AMD family 15h when 'align_va_addr' is enabled.
>
> I'm sorry, but this is a big NAK from the x86 side, without at _least_ a
> substantially improved changelog and evidence that x86 is both the only
> place to reasonably fix this _and_ evidence that no other arch is affected.
>
> Why?
>
> x86 is not the only architecture that uses .align_offset.

Yes, although we skip setting it for hugetlb mappings already some other
arches like sparc and s390.

> The bug was introduced in a generic, non-x86 commit (7bd3f1e1a9ae)
>
> The real fix is almost surely in arch-generic code.
>
> So my fear is that we'll apply the x86 thing. Four other architectures
> will come along and have to add their own fixes. Then (if we're lucky)
> someone will stick around and fix it properly, than all the
> architectures will have to remove their hacks.

Yes, I am not happy either with the current code, given that some arches have
to do this dance of skip-offset-if-hugetlb and feels _quite_ wrong to do
it at arch level, given that only hugetlb needs that and given that
hugetlb is not the only one needing aligned things (thp?).

> Worst-case, we end up with a latent bug, just without any testing
> coverage because x86 testing is the most broad.
>
> Oscar, even if the real fix involves a couple of patches, can we please
> see that, first? Then, we can go back and make an informed decision
> about hacks versus proper fixes.

Sure, as I already said I was not happy with the fix either, was just an
attempt to address the regression quicker.
Having said that, and proven that you are not happy either, let me take
the long(er) road and come up with a proper fix for everyone, so no more
hacks on arch level are needed.


--
Oscar Salvador
SUSE Labs