aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-08-13 08:36:29 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-12-15 17:35:14 -0300
commit5f6d8d97c69748180f0031dfa385aff75062c4d5 (patch)
tree97837a8eab4175385c32bacb10dc633b9070f266 /manual
parentcb976fba4c51ede7bf8cee5035888527c308dfbc (diff)
downloadglibc-5f6d8d97c69748180f0031dfa385aff75062c4d5.zip
glibc-5f6d8d97c69748180f0031dfa385aff75062c4d5.tar.gz
glibc-5f6d8d97c69748180f0031dfa385aff75062c4d5.tar.bz2
malloc: Add madvise support for Transparent Huge Pages
Linux Transparent Huge Pages (THP) current supports three different states: 'never', 'madvise', and 'always'. The 'never' is self-explanatory and 'always' will enable THP for all anonymous pages. However, 'madvise' is still the default for some system and for such case THP will be only used if the memory range is explicity advertise by the program through a madvise(MADV_HUGEPAGE) call. To enable it a new tunable is provided, 'glibc.malloc.hugetlb', where setting to a value diffent than 0 enables the madvise call. This patch issues the madvise(MADV_HUGEPAGE) call after a successful mmap() call at sysmalloc() with sizes larger than the default huge page size. The madvise() call is disable is system does not support THP or if it has the mode set to "never" and on Linux only support one page size for THP, even if the architecture supports multiple sizes. To test is a new rule is added tests-malloc-hugetlb1, which run the addes tests with the required GLIBC_TUNABLE setting. Checked on x86_64-linux-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'manual')
-rw-r--r--manual/tunables.texi10
1 files changed, 10 insertions, 0 deletions
diff --git a/manual/tunables.texi b/manual/tunables.texi
index 28ff502..9ca6e3f 100644
--- a/manual/tunables.texi
+++ b/manual/tunables.texi
@@ -270,6 +270,16 @@ 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.
@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}.
+
+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).
+@end deftp
+
@node Dynamic Linking Tunables
@section Dynamic Linking Tunables
@cindex dynamic linking tunables