public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Norbert Manthey <nmanthey@conp-solutions.com>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	Siddhesh Poyarekar <siddhesh@sourceware.org>
Subject: Re: [[RFC][PATCH] v1 0/2] malloc/realloc with transparent huge page support
Date: Sun, 3 May 2020 15:15:42 -0700	[thread overview]
Message-ID: <CAMe9rOo_DhKZNk=Q4D4bQr56YTrF7guJbuaAsm-tiAGB-rcKew@mail.gmail.com> (raw)
In-Reply-To: <20200503220708.2048246-1-nmanthey@conp-solutions.com>

On Sun, May 3, 2020 at 3:09 PM Norbert Manthey
<nmanthey@conp-solutions.com> wrote:
>
> Dear all,
>
> I have been looking for a way to enable huge pages in a user land process
> without privileges, and without modifying the source of the process.
>
> Huge pages had to be used explicitly via linking against special libraries.
> An alternative are transparent huge pages, which are easier to obtain, but there
> are no guarantees of success. Using transparent huge pages can also result in
> slowdowns. Many Linux based distributions enable transparent huge pages via
> madvise, so that user land processes. With the madvise system call, a process
> can control whether allocated memory should be mapped with huge pages. However,
> the process typically only sees the allocations returned via a single malloc or
> realloc invocation, most of them being rather small.
>
> For a larger impact, I modified the way allocations are done behind the scenes.
> For the allocated memory, I changed the properties to (1) align to 2M instead
> of 4K, and (2) to call the madvise system call after the brk system call, to
> signal that the used memory area should be mapped with huge pages.
>
> The default behavior is not modified. The modification can currently be enabled,
> by specifying the environment variable GLIBC_THP_ALWAYS.
>

Please use GLIBC_TUNABLES framework.

-- 
H.J.

  parent reply	other threads:[~2020-05-03 22:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 22:07 Norbert Manthey
2020-05-03 22:07 ` [[RFC][PATCH] v1 1/2] malloc: support transparent huge pages Norbert Manthey
2020-05-03 22:07 ` [[RFC][PATCH] v1 2/2] malloc: improve THP effectiveness Norbert Manthey
2020-05-03 22:21   ` Andrew Pinski
2020-05-03 22:15 ` H.J. Lu [this message]
2020-05-04  4:36 ` [[RFC][PATCH] v1 0/2] malloc/realloc with transparent huge page support Florian Weimer
2020-05-04  6:58   ` Norbert Manthey
2020-05-04  7:07     ` Florian Weimer
2020-05-04 21:07 ` DJ Delorie
2020-05-04 21:44   ` Norbert Manthey
     [not found] <7bd30e6c-7ae8-4c03-a818-6309351b3df9@email.android.com>
2020-05-04  8:27 ` Florian Weimer
2020-05-04 13:31   ` Adhemerval Zanella

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='CAMe9rOo_DhKZNk=Q4D4bQr56YTrF7guJbuaAsm-tiAGB-rcKew@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --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).