unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Guillaume Morin <guillaume@morinfr.org>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Norbert Manthey <nmanthey@conp-solutions.com>,
	Siddhesh Poyarekar <siddhesh@sourceware.org>,
	libc-alpha@sourceware.org,
	Guillaume Morin <guillaume@morinfr.org>
Subject: Re: [PATCH 0/3] malloc: improve THP effectiveness
Date: Fri, 13 Aug 2021 23:37:26 +0200	[thread overview]
Message-ID: <20210813213725.GA9384@bender.morinfr.org> (raw)
In-Reply-To: <20210813210429.1147112-1-adhemerval.zanella@linaro.org>

Hello Adhemerval,

On 13 Aug 18:04, Adhemerval Zanella wrote:
> Although it does improve THP effectiveness, it does not provide the same
> features from libhugetlsfs morecore implementation [2], since it does
> use MAP_HUGETLB explicit on mmap.  And I think this is not what we want
> for glibc, it requires additional setup from the admin to mount the
> hugetlsfs and reserve the pages with it outside from glibc scope.

I certainly do appreciate the effort. But unfortunately this is not a
usable replacement for most libhugetlblfs users (who actually want to use
hugetlbfs).

First, I'll argue to have THP supported directly in the allocator is
probably a nice-to-have feature for THP users but probably not that
critical considering you can just madvise() the memory *after*
it's been allocated. Alternatively any malloc interposition scheme can
do this trivially: afaik there were never an actual *need* for a
morecore implementation in this case.
There is no such possibility with hugetlbfs. It's either mmap() with
MAP_HUGETLB or not.

Second, THP is not a drop-in replacement for hugetblfs. hugetlbfs has
desirable properties that simply do not exist for THP. Just a few
examples: 1) A hugetlbfs allocation gives you a huge page or not at
allocation time but this is forever. There is no splitting, re-merging
by the VM: no TLB shootdowns for running processes etc. 2) Fast
allocation: there is a dedicated pool of these pages.  There is no
competition with the rest of the processes unlike THP 3) No swapping all
hugetlbfs pages.

I would really like to discuss and/or maybe implement some schemable
that allows to optionally use MAP_HUGETLB for all allocations (which
would be a definitive improvement over what libhugetlbfs was doing) if
that's workable for you.

Guillaume.

-- 
Guillaume Morin <guillaume@morinfr.org>

  parent reply	other threads:[~2021-08-13 21:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 21:04 [PATCH 0/3] malloc: improve THP effectiveness Adhemerval Zanella via Libc-alpha
2021-08-13 21:04 ` [PATCH 1/3] malloc: Add madvise support for Transparent Huge Pages Adhemerval Zanella via Libc-alpha
2021-08-13 21:04 ` [PATCH 2/3] malloc: Add THP/madvise support for sbrk Adhemerval Zanella via Libc-alpha
2021-08-13 21:04 ` [PATCH 3/3] malloc: Add arch-specific malloc_verify_thp_pagesize for Linux Adhemerval Zanella via Libc-alpha
2021-08-13 21:37 ` Guillaume Morin [this message]
2021-08-16 20:55   ` [PATCH 0/3] malloc: improve THP effectiveness Adhemerval Zanella via Libc-alpha
2021-08-17  4:00     ` Siddhesh Poyarekar via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=20210813213725.GA9384@bender.morinfr.org \
    --to=guillaume@morinfr.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=nmanthey@conp-solutions.com \
    --cc=siddhesh@sourceware.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).