[PATCH] support: Also run malloc hugetlb2 tests when transparent hugepage is 'always'
Yury Khrustalev
yury.khrustalev@arm.com
Tue Jun 2 13:43:40 GMT 2026
On Mon, Jun 01, 2026 at 10:17:29AM -0300, Adhemerval Zanella wrote:
> The glibc.malloc.hugetlb=1 is redundant with kernel is n 'always'
> mode, but the madvise does work, and the tunable should not fail.
Thanks, just a couple of typos below.
> diff --git a/support/support_check_hugetlb.c b/support/support_check_hugetlb.c
> index be7e10e80d6..2ea78e4fa39 100644
> --- a/support/support_check_hugetlb.c
> +++ b/support/support_check_hugetlb.c
>
> ...
>
> #define MODE_MADVISE "always [madvise] never\n"
> +#define MODE_ALWAYS "[always] madvise never\n"
>
> char str[sizeof(MODE_MADVISE)];
> ssize_t s = read (fd, str, sizeof (str));
> @@ -42,7 +43,7 @@ support_thp_is_madvise (void)
> if (s != sizeof (str) - 1)
> return false;
> str[s] = '\0';
> - return strcmp (str, MODE_MADVISE) == 0;
> + return strcmp (str, MODE_MADVISE) == 0 || strcmp (str, MODE_ALWAYS);
It should be: strcmp (str, MODE_ALWAYS) == 0
> }
>
> bool
> @@ -69,7 +70,7 @@ support_check_malloc_hugetlb (void)
> return;
>
> size_t hugetlb = TUNABLE_GET_FULL (glibc, malloc, hugetlb, size_t, NULL);
> - if (hugetlb == 1 && !support_thp_is_madvise ())
> + if (hugetlb == 1 && !support_thp_work_madvise ())
> FAIL_UNSUPPORTED ("glibc.malloc.hugetlb=1 requires"
> " /sys/kernel/mm/transparent_hugepage/enabled"
> " = madvise");
Nit: perhaps rephrase the message to something like
glibc.malloc.hugetlb=1 requires that transparent_hugepage is either
madvise or always
To include both accepted values?
More information about the Libc-alpha
mailing list