From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Proposed approach for malloc to deal with failing brk
Date: Mon, 31 Mar 2014 13:05:59 +0200 [thread overview]
Message-ID: <20140331110559.GB3034@port70.net> (raw)
In-Reply-To: <20140331004104.GA15223@brightrain.aerifal.cx>
* Rich Felker <dalias@aerifal.cx> [2014-03-30 20:41:04 -0400]:
> We want brk. This is not because "brk is faster than mmap", but
> because it takes a lot of work to replicate what brk does using mmap,
> and there's no hope of making a complex dance of multiple syscalls
> equally efficient. My best idea for emulating brk was to mmap a huge
another reason to have brk: on some archs there is a TASK_UNMAPPED_BASE
limit in the kernel (1G normally) and mmap can only allocate above that
a large part of the first 1G is used for brk only (and top 1G is kernel)
so an mmap only allocator would limit the malloc space to 2G
(at least 32bit arm and mips i think)
> Once brk has failed, begin obtaining new blocks to add to the heap via
> mmap, with the size carefully chosen:
>
> MAX(requested_size, PAGE_SIZE<<(mmap_cnt/2))
yes this works, i added a regression test for brk failure
next prev parent reply other threads:[~2014-03-31 11:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 0:41 Rich Felker
2014-03-31 4:32 ` Rich Felker
2014-03-31 7:44 ` u-igbb
2014-03-31 11:05 ` Szabolcs Nagy [this message]
2014-04-01 16:40 ` Vasily Kulikov
2014-04-01 17:01 ` Szabolcs Nagy
2014-04-01 17:03 ` Rich Felker
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=20140331110559.GB3034@port70.net \
--to=nsz@port70.net \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).