[PATCH] malloc: Avoid accessing /sys/kernel/mm files
Aurelien Jarno
aurelien@aurel32.net
Tue Mar 3 20:01:20 GMT 2026
Hi Wilco,
On 2026-03-03 18:06, Wilco Dijkstra wrote:
> Hi Aurelien,
>
> On 2026-03-01 22:37, Aurelien Jarno wrote:
> > Hi Wilco,
> >
> > On 2026-02-27 21:03, Wilco Dijkstra wrote:
> > >
> > > On AArch64 malloc always checks /sys/kernel/mm/transparent_hugepage/enabled to set
> > > the THP mode. However this check is quite expensive and the file may not be accessible
> > > in containers. If DEFAULT_THP_PAGESIZE is non-zero, use malloc_thp_mode_madvise so that
> > > we take advantage of THP in all cases. Since madvise is a fast systemcall, it adds only
> > > a small overhead compared to the cost of mmap and populating the pages.
> > >
> > > Passes regress, OK for commit?
> >
> > The strategy sounds good if you confirm it does not have performance
> > impact. Not having to probe a file in /sys is definitely way better.
>
> It actually appears to be slightly faster overall on SPEC. For short-lived utilities that
> use little memory it should be faster due to avoiding the read of /sys during startup.
Great that you were able to quantify the performance impact. With that,
I think that the patch is good to go.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Cheers
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
More information about the Libc-alpha
mailing list