From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4767 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Proposed approach for malloc to deal with failing brk Date: Tue, 1 Apr 2014 19:01:58 +0200 Message-ID: <20140401170157.GC3034@port70.net> References: <20140331004104.GA15223@brightrain.aerifal.cx> <20140401164057.GA8347@cachalot> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1396371744 5481 80.91.229.3 (1 Apr 2014 17:02:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Apr 2014 17:02:24 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4771-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 01 19:02:19 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WV24g-0005Wi-JI for gllmg-musl@plane.gmane.org; Tue, 01 Apr 2014 19:02:10 +0200 Original-Received: (qmail 15800 invoked by uid 550); 1 Apr 2014 17:02:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 15791 invoked from network); 1 Apr 2014 17:02:09 -0000 Content-Disposition: inline In-Reply-To: <20140401164057.GA8347@cachalot> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4767 Archived-At: * Vasily Kulikov [2014-04-01 20:40:57 +0400]: > On Sun, Mar 30, 2014 at 20:41 -0400, Rich Felker wrote: > > 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 > > PROT_NONE region and gradually mprotect it to PROT_READ|PROT_WRITE, > > What problem do you try to solve via PROT_NONE -> PROT_WRITE? Why not writable page is commit charge and that matters with a huge mmap on systems with no overcommit > simply instantly mmap it as PROT_WRITE? Linux will not allocate physical pages > until the first access, so you don't lose physical memory when it is not > actually used.