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

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <CAMe9rOpzAUywYMAJPz0N9Qpq2Nk_HiGSHJ8Edf+6_8qb1xFYRg@mail.gmail.com>
On Thu, Jul 23, 2026 at 2:17 AM Wilco Dijkstra <[email protected]> wrote:
>
> 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?

You need to run it under a kernel without THP support.  That is there is
no /sys/kernel/mm/transparent_hugepage/enabled.

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



-- 
H.J.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.