Received: from [140.186.70.92] (port=58695 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PMf4x-0008ST-4p for qemu-devel@nongnu.org; Sun, 28 Nov 2010 06:06:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PMf4v-0002VW-7X for qemu-devel@nongnu.org; Sun, 28 Nov 2010 06:05:58 -0500 Received: from adelie.canonical.com ([91.189.90.139]:39917) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PMf4u-0002VO-Ui for qemu-devel@nongnu.org; Sun, 28 Nov 2010 06:05:57 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1PMf4s-0008IP-3w for ; Sun, 28 Nov 2010 11:05:54 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 7A1E72E80AE for ; Sun, 28 Nov 2010 11:05:53 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Sun, 28 Nov 2010 10:58:35 -0000 From: Brian Harring Sender: bounces@canonical.com References: <20101128105835.27278.44074.malonedeb@soybean.canonical.com> Message-Id: <20101128105835.27278.98913.malone@soybean.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 682326] Re: linux-user/mmap exhaustion Reply-To: Bug 682326 <682326@bugs.launchpad.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ** Attachment added: "0001-try-to-reuse-recently-freed-mmap-space-to-reduce= -gue.patch" https://bugs.launchpad.net/bugs/682326/+attachment/1747588/+files/0001-t= ry-to-reuse-recently-freed-mmap-space-to-reduce-gue.patch -- = linux-user/mmap exhaustion https://bugs.launchpad.net/bugs/682326 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: New Bug description: Currently when executing a linux-user target, mmap.c is in use- the model i= t uses internally for figuring out what the mmap address actually should be= basically is an accumulator, every mmap invocation (regardless of munmap's= that cleared the previous usage) is center on the next page. The end result of this is that it'll burn it's way through the space soon e= nough, especially if it's a 64bit host w/ a 32bit target- the host starts g= iving back 64bit addresses and the emulated mmap falls over after failed at= tempts at a low MAP_FIXED range. Where this becomes problematic is that glibc's FILE internals mmap a *lot*-= once per handle. Any long running process can hit this wall- rpmbuild unf= ortunately is pretty loose in it's FILE creation/usage, so it hits the wall= surprisingly fast- at least on an opensuse 11.2 system w/ mmap_min_addr of= 65536 (their default), building qt reliably hits that exhaustion during pa= ckaging. Attached is basically, a hack- but one that works surprisingly well and at = least for meego building via qemu-arm, eliminates the failure scenario I've= described above. It doesn't remove the exhaustion as much as push it a fa= ir bit back, although there are still a couple of ways to trigger it (http:= //bugs.meego.com/show_bug.cgi?id=3D10526 is the only remaining example I'm = aware of). This patch simply checks to see if upon an actual, host level munmap, if th= e ending point of the munmap is where we'd allocate from next- if so, it sh= ifts the starting point back to the (now) unmap'd start, reusing the space.= Rebuilding meego a couple of times over, thus far I've not managed to flu= sh out any failures that point at this specific patch, so... it looks like = it's doing the trick- that said the lack of a g2h/h2g in the calculation st= ill seems questionable to me.