From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4766 Path: news.gmane.org!not-for-mail From: Vasily Kulikov Newsgroups: gmane.linux.lib.musl.general Subject: Re: Proposed approach for malloc to deal with failing brk Date: Tue, 1 Apr 2014 20:40:57 +0400 Message-ID: <20140401164057.GA8347@cachalot> References: <20140331004104.GA15223@brightrain.aerifal.cx> 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 1396370479 21852 80.91.229.3 (1 Apr 2014 16:41:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Apr 2014 16:41:19 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4770-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 01 18:41:15 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 1WV1kO-0004GC-H6 for gllmg-musl@plane.gmane.org; Tue, 01 Apr 2014 18:41:12 +0200 Original-Received: (qmail 3805 invoked by uid 550); 1 Apr 2014 16:41:11 -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 3797 invoked from network); 1 Apr 2014 16:41:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=QgekP6TA8k2uqa8A5WutSagKt2fgSiBfe+oEjjt8wV0=; b=VnF+1age+afTBqQAUHbyZlU+Wf8VJoAzmIwowwxcrdt1ZV48tbKAPYEmaWuvcUa6GV boUFHt5XRl1AChb/+8uUbX7KNAg548ptHFKUWIYmSZgjV7nymicz8ul2a+CtSSFUnChY zOCVFKbzHHaWb9pvC+ku+eJyscv2cZ/e3/iT/jvsDQfLM3x3RhXZ3U5OaM3XqravNKv9 NFXpO1iBYMw/5T3jk9LO/lBZ/eOGgoQ4w9DwE0LB06LeLQJAWE1qeJVf3DhABRKewFN4 gmUQjhAa8vQIFxsNPvDxO62VH99xvtIil/3e5Q76Gjm+pX/QHLXAhqsAutxSJAMB8Th3 IO3g== X-Received: by 10.152.18.229 with SMTP id z5mr10751221lad.27.1396370460441; Tue, 01 Apr 2014 09:41:00 -0700 (PDT) Original-Sender: Vasiliy Kulikov Content-Disposition: inline In-Reply-To: <20140331004104.GA15223@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4766 Archived-At: 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 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. > but it turns out this is what glibc does for per-thread arenas and > it's really slow, probably because it involves splitting one VMA and > merging into another. Yes, both VMA split/merge and PTE/etc. changes. -- Vasily