Re: [REGRESSION] x86/hugetlb: AMD F15h VA alignment offset breaks MAP_HUGETLB alignment
From: Dave Hansen
Date: Wed May 27 2026 - 17:05:53 EST
On 5/27/26 11:28, Oscar Salvador (SUSE) wrote:
> if (filp) {
> info.align_mask = get_align_mask(filp);
> - info.align_offset += get_align_bits();
> + /*
> + * Hugepages must remain hugepage-aligned, so skip adding an offset
> + * in case we enabled 'align_va_addr'.
> + */
> + if (!is_file_hugepages(filp))
> + info.align_offset += get_align_bits();
> }
That's a good hack to show the scope of the problem.
But I'd really rather this be dealt with in the arch-independent code,
not by adding hugetlb hacks to arch code. It isn't even clear to me what
exactly goes wrong when you set a tiny ->align_offset and have a larger
->align_mask. Shouldn't the tiny offset just get masked off?
gap += (info->align_offset - gap) & info->align_mask;
I spent a whole five seconds looking at it, but something seems to be
missing from the problem description.