From owner-freebsd-arch Fri Jan 10 23:39:41 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDC1E37B401 for ; Fri, 10 Jan 2003 23:39:39 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1C7F543ED8 for ; Fri, 10 Jan 2003 23:39:39 -0800 (PST) (envelope-from phk@freebsd.org) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id h0B7ZSFt003789; Sat, 11 Jan 2003 08:35:29 +0100 (CET) (envelope-from phk@freebsd.org) To: Archie Cobbs Cc: freebsd-arch@freebsd.org Subject: Re: Virtual memory question From: phk@freebsd.org In-Reply-To: Your message of "Fri, 10 Jan 2003 18:00:53 PST." <200301110200.h0B20rUC024725@arch20m.dellroad.org> Date: Sat, 11 Jan 2003 08:35:28 +0100 Message-ID: <3788.1042270528@critter.freebsd.dk> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <200301110200.h0B20rUC024725@arch20m.dellroad.org>, Archie Cobbs wri tes: >The question is: how does the performance of various FreeBSD system >calls (especially mmap() and munmap()) degrade when a process has >lots and lots of tiny regions mapped into memory? Badly. At least it used to do: When I wrote phkmalloc(3) I tried using malloc instead of sbrk(2) and it suffered because the VM system couldn't collapse all the individual allocations (ie: N lines in /proc/$pid/map Poul-Henning > >I'm working on a memory allocator that would allocate say a few >pages at a time, using mmap() (instead of sbrk()). So over time a >process may end up with hundreds or even thousands of short, mmap()'d >regions of memory. Is this going to cause any weird problems or >slowness? > >BTW this idea was spawned by this text in the sbrk(3) man page: > > The brk() and sbrk() functions are legacy interfaces from > before the advent of modern virtual memory management. > >Along those lines, why does our malloc(3) library use sbrk(3) instead >of mmap(), which would enable returning free pages back to the system >more readily (since the pages would not have to be contiguous)? > >Thanks, >-Archie > >__________________________________________________________________________ >Archie Cobbs * Packet Design * http://www.packetdesign.com > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-arch" in the body of the message > -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message