From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [RFC PATCH] reduce severity of ldso reclaim_gaps hack
Date: Thu, 12 Apr 2018 09:26:29 -0400 [thread overview]
Message-ID: <20180412132629.GQ3094@brightrain.aerifal.cx> (raw)
In-Reply-To: <alpine.LNX.2.20.13.1804120937510.24851@monopod.intra.ispras.ru>
On Thu, Apr 12, 2018 at 09:40:23AM +0300, Alexander Monakov wrote:
> On Thu, 12 Apr 2018, Rich Felker wrote:
> > > > This does not seem necessary. Free chunks in the last bin can be
> > > > larger than MMAP_THRESHOLD; they're just broken up to satisfy
> > > > allocations. Of course it's unlikely to happen anyway.
> > >
> > > Do such oversized chunks appear in normal operation? This seems non-obvious,
> > > so a comment pointing that out would probably be helpful.
> >
> > The only way I could see it happening is on an arch ABI that allows
> > very large pages (and has the ELF load segments aligned accordingly,
> > as x86_64 does). In this case if the kernel/hardware only supported
> > large (e.g. 2MB) pages, you'd pretty much always end up with >1.5MB of
> > reclaimed space per DSO. IMO this is an awful kernel/hardware
> > constraint to have, very wasteful, but it's exactly the situation
> > where you'd most care about the gaps getting reclaimed for something
> > useful.
>
> What I meant to ask is: apart from chunks created via reclaim_gaps, can
> such oversized chunks appear as a result of malloc-family calls invoked
> by the program?
Yes, simple:
void *p[1000];
for (i=0; i<1000; i++) p[i]=malloc(1000);
for (i=0; i<1000; i++) free(p[i]);
Rich
prev parent reply other threads:[~2018-04-12 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 16:52 Alexander Monakov
2018-04-11 20:10 ` Rich Felker
2018-04-11 21:19 ` Alexander Monakov
2018-04-12 4:04 ` Rich Felker
2018-04-12 6:40 ` Alexander Monakov
2018-04-12 13:26 ` Rich Felker [this message]
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=20180412132629.GQ3094@brightrain.aerifal.cx \
--to=dalias@libc.org \
--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).