From: Mike Frysinger <vapier@gentoo.org>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Reduce number of mmap calls from __libc_memalign in ld.so
Date: Sat, 02 Apr 2016 17:33:00 -0000 [thread overview]
Message-ID: <20160402173308.GU6588@vapier.lan> (raw)
In-Reply-To: <20160402153421.GA28788@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]
On 02 Apr 2016 08:34, H.J. Lu wrote:
> __libc_memalign in ld.so allocates one page at a time and tries to
> optimize consecutive __libc_memalign calls by hoping that the next
> mmap is after the current memory allocation.
>
> However, the kernel hands out mmap addresses in top-down order, so
> this optimization in practice never happens, with the result that we
> have more mmap calls and waste a bunch of space for each __libc_memalign.
>
> This change makes __libc_memalign to mmap one page extra. Worst case,
> the kernel never puts a backing page behind it, but best case it allows
> __libc_memalign to operate much much better. For elf/tst-align --direct,
> it reduces number of mmap calls from 12 to 9.
>
> --- a/elf/dl-minimal.c
> +++ b/elf/dl-minimal.c
> @@ -75,6 +75,7 @@ __libc_memalign (size_t align, size_t n)
> return NULL;
> nup = GLRO(dl_pagesize);
> }
> + nup += GLRO(dl_pagesize);
should this be in the else case ?
also the comment above this code needs updating
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-02 17:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-02 15:34 H.J. Lu
2016-04-02 17:33 ` Mike Frysinger [this message]
2016-04-02 17:43 ` H.J. Lu
2016-04-02 22:41 ` H.J. Lu
2016-04-03 6:56 ` Andreas Schwab
2016-04-03 13:42 ` H.J. Lu
2016-04-23 12:57 ` H.J. Lu
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=20160402173308.GU6588@vapier.lan \
--to=vapier@gentoo.org \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@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).