public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org, zhangfei.gao@linaro.org
Subject: Re: [PATCH v2 2/2] malloc: Improve MAP_HUGETLB with glibc.malloc.hugetlb=2
Date: Tue, 28 Nov 2023 16:43:56 -0500	[thread overview]
Message-ID: <xnedg91rkz.fsf@greed.delorie.com> (raw)
In-Reply-To: <20231123172915.893408-3-adhemerval.zanella@linaro.org> (message from Adhemerval Zanella on Thu, 23 Nov 2023 14:29:15 -0300)

Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> diff --git a/malloc/arena.c b/malloc/arena.c
> index a1a75e5a2b..c73f68890d 100644
> --- a/malloc/arena.c
> +++ b/malloc/arena.c
> @@ -312,10 +312,17 @@ ptmalloc_init (void)
>  # endif
>    TUNABLE_GET (mxfast, size_t, TUNABLE_CALLBACK (set_mxfast));
>    TUNABLE_GET (hugetlb, size_t, TUNABLE_CALLBACK (set_hugetlb));
> +
>    if (mp_.hp_pagesize > 0)
> -    /* Force mmap for main arena instead of sbrk, so hugepages are explicitly
> -       used.  */
> -    __always_fail_morecore = true;
> +    {
> +      /* Force mmap for main arena instead of sbrk, so MAP_HUGETLB is always
> +         tried.  Also tune the mmap threshold, so allocation smaller than the
> +	 large page will also try to use large pages by falling back
> +	 to sysmalloc_mmap_fallback on sysmalloc.  */
> +      if (!TUNABLE_IS_INITIALIZED (mmap_threshold))
> +	do_set_mmap_threshold (mp_.hp_pagesize);
> +      __always_fail_morecore = true;
> +    }
>  }
>  
>  /* Managing heaps and arenas (for concurrent threads) */

Ok.

LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>


  reply	other threads:[~2023-11-28 21:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 17:29 [PATCH v2 0/2] " Adhemerval Zanella
2023-11-23 17:29 ` [PATCH v2 1/2] elf: Add a way to check if tunable is set (BZ 27069) Adhemerval Zanella
2023-11-28 21:38   ` DJ Delorie
2023-11-29 12:29     ` Adhemerval Zanella Netto
2023-11-23 17:29 ` [PATCH v2 2/2] malloc: Improve MAP_HUGETLB with glibc.malloc.hugetlb=2 Adhemerval Zanella
2023-11-28 21:43   ` DJ Delorie [this message]
2023-11-24  7:57 ` [PATCH v2 0/2] " Zhangfei Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xnedg91rkz.fsf@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=zhangfei.gao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).