[PATCH 4/4] mm: align file-backed mmap to exec folio order in thp_get_unmapped_area
WANG Rui
r at hev.cc
Fri Mar 13 20:47:44 PDT 2026
> + if (exec_folio_order()) {
> + unsigned long folio_size = PAGE_SIZE << exec_folio_order();
> +
> + ret = __thp_get_unmapped_area(filp, addr, len, off, flags,
> + folio_size, vm_flags);
> + if (ret)
> + return ret;
> + }
> +
I noticed that even when the code segment of a user-space shared library
satisfies PMD_SIZE (32MB), it still doesn’t end up at a PMD-aligned virtual
address. This might be the fallback you mentioned. Adjusting p_align in the
ld.so ELF loader does work, though it also avoids extremely large PMD_SIZE
values (capped at ≤32M).
It would probably be better to skip the PMD_SIZE == folio_sz case here,
so we don’t end up calling __thp_get_unmapped_area() twice with the same
parameters.
Thanks,
Rui
More information about the linux-arm-kernel
mailing list