[PATCH] thp: Disable THP if THP isn't supported by kernel

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed Jul 22 18:16:38 GMT 2026


Hi HJ,

> Since DL_MAP_DEFAULT_THP_PAGESIZE is defined for x86-64, THP control
> is to set to madvise by default.  If THP is disabled in x86-64 kernel,
> madvise (..., MADV_HUGEPAGE) returns -EINVAL to indicate that THP isn't
> supported.  Add _dl_thp_madvise to disable THP in this case.  This
> fixes BZ #34348.

Are there enough calls in the loader that this is worthwhile?

More importantly, does this actually work? I always get 0 result from madvise
calls irrespectively of the madvise settings... Does it need a new kernel or is
this target specific?

If we can get it to work, it could be useful in madvise_thp() since there are
potentially millions madvise calls.

Cheers,
Wilco


More information about the Libc-alpha mailing list