[PATCH] malloc: Enable THP always support on hugetlb tunable

William Hunt william.hunt@arm.com
Wed Jul 9 11:56:48 GMT 2025


On 2025-07-08 19:05, Adhemerval Zanella Netto wrote:
> > @@ -2011,6 +2013,11 @@ static inline void
> >  madvise_thp (void *p, INTERNAL_SIZE_T size)
> >  {
> >  #ifdef MADV_HUGEPAGE
> > +  /* Only use __madvise if the system is using 'madvise' mode.
> > +     Otherwise the call is wasteful. */
> > +  if (mp_.thp_mode != malloc_thp_mode_madvise)
> > +    return;
> > +
> Does __glibc_likely make any difference here?

I did not find any significant performance gains due to mmap calls
taking up enough time to make any differences immeasurable. Since
THPs are not enabled this condition is likely true, so for readability 
I can add the __glibc_likely if this helps, otherwise I will leave 
the code as is.


More information about the Libc-alpha mailing list