malloc: Improve documentation of malloc tunables

Dimitri John Ledkov dimitri.ledkov@surgut.co.uk
Wed Mar 11 16:50:37 GMT 2026


On Tue, 10 Mar 2026 at 15:57, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
>
> Update default for tcache_count tunable.  Remove existing documentation and
> mention removal of fastbins in mxfast tunable.  Improve wording of hugetlb
> tunable, including default for AArch64.
>
> OK for commit?
>

Did a test build, and read the new docs, they formatted correctly for
me and I like the updates. All of them are accurate. Thank you.

Tested-By: Dimitri John Ledkov <dimitri.ledkov@surgut.co.uk>

> ---
>
> diff --git a/manual/tunables.texi b/manual/tunables.texi
> index 72769428e8cac27723fdec9ad83a92dc0b27415a..5850945a59e8494a2bb315da5a3e919112c5c562 100644
> --- a/manual/tunables.texi
> +++ b/manual/tunables.texi
> @@ -231,37 +231,29 @@ per-thread cache.  The default (and maximum) value is 1032 bytes on
>  @end deftp
>
>  @deftp Tunable glibc.malloc.tcache_count
> -The maximum number of chunks of each size to cache. The default is 7.
> +The maximum number of chunks of each size to cache. The default is 16.
>  The upper limit is 65535.  If set to zero, the per-thread cache is effectively
>  disabled.
>
>  The approximate maximum overhead of the per-thread cache is thus equal
>  to the number of bins times the chunk count in each bin times the size
> -of each chunk.  With defaults, the approximate maximum overhead of the
> -per-thread cache is approximately 236 KB on 64-bit systems and 118 KB
> -on 32-bit systems.
> +of each chunk.
>  @end deftp
>
>  @deftp Tunable glibc.malloc.mxfast
> -One of the optimizations @code{malloc} uses is to maintain a series of ``fast
> -bins'' that hold chunks up to a specific size.  The default and
> -maximum size which may be held this way is 80 bytes on 32-bit systems
> -or 160 bytes on 64-bit systems.  Applications which value size over
> -speed may choose to reduce the size of requests which are serviced
> -from fast bins with this tunable.  Note that the value specified
> -includes @code{malloc}'s internal overhead, which is normally the size of one
> -pointer, so add 4 on 32-bit systems or 8 on 64-bit systems to the size
> -passed to @code{malloc} for the largest bin size to enable.
> +This tunable has no effect since the ``fastbins'' have been removed.
>  @end deftp
>
>  @deftp Tunable glibc.malloc.hugetlb
>  This tunable controls the usage of Huge Pages on @code{malloc} calls.  The
> -default value is @code{0}, which disables any additional support on
> -@code{malloc}.
> +default value is @code{0} on most targets.  Using @code{0} disables support
> +that improves use of huge pages in @code{malloc}.  However huge pages may
> +still be created depending on the OS settings.
>
>  Setting its value to @code{1} enables the use of @code{madvise} with
>  @code{MADV_HUGEPAGE} after memory allocation with @code{mmap}.  It is enabled
>  only if the system supports Transparent Huge Page (currently only on Linux).
> +This is the default used for AArch64.
>
>  Setting its value to @code{2} enables the use of Huge Page directly with
>  @code{mmap} with the use of @code{MAP_HUGETLB} flag.  The huge page size
>


-- 
Regards,

Dimitri.


More information about the Libc-alpha mailing list