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

Wilco Dijkstra <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <PAWPR08MB89829EFE1CB90F09AB9A739283C02@PAWPR08MB8982.eurprd08.prod.outlook.com>
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.

I see, but that makes it a rare case for some non-standard containers, so not
worth trying to optimize for. I was hoping there is a magic way to efficiently
get the madvise state...

Cheers,
Wilco
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.