From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 25 23:56:51 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E4ED216A4B3 for ; Sat, 25 Oct 2003 23:56:51 -0700 (PDT) Received: from VARK.homeunix.com (adsl-68-123-140-7.dsl.pltn13.pacbell.net [68.123.140.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77A8443FBD for ; Sat, 25 Oct 2003 23:56:50 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: from VARK.homeunix.com (localhost [127.0.0.1]) by VARK.homeunix.com (8.12.9/8.12.9) with ESMTP id h9Q6uLen021861; Sat, 25 Oct 2003 23:56:21 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.homeunix.com (8.12.9/8.12.9/Submit) id h9Q6uLwu021860; Sat, 25 Oct 2003 23:56:21 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Sat, 25 Oct 2003 23:56:21 -0700 From: David Schultz To: Mike Silbersack Message-ID: <20031026065621.GA21546@VARK.homeunix.com> Mail-Followup-To: Mike Silbersack , =?us-ascii:iso-8859-1?B?ODg1OS0xP1E/U209RjhyZ3Jhdj89?=" , freebsd-hackers@FreeBSD.ORG, Q , Kris Kennaway References: <1066789354.21430.39.camel@boxster.onthenet.com.au> <20031022082953.GA69506@rot13.obsecurity.org> <1066816287.25609.34.camel@boxster.onthenet.com.au> <20031022095754.GA70026@rot13.obsecurity.org> <1066820436.25609.93.camel@boxster.onthenet.com.au> <20031026052854.GA20701@VARK.homeunix.com> <20031026005938.L2023@odysseus.silby.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031026005938.L2023@odysseus.silby.com> cc: "Dag-Erling =?us-ascii:iso-8859-1?Q?=3D=3Fus-ascii=3Aiso-8859-1=3FQ=3FS?= =?us-ascii:iso-8859-1?B?bT1GOHJncmF2Pz0=?=" cc: Kris Kennaway cc: Q cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Some mmap observations compared to Linux 2.6/OpenBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2003 06:56:52 -0000 On Sun, Oct 26, 2003, Mike Silbersack wrote: > > On Sat, 25 Oct 2003, David Schultz wrote: > > > But regardless of the approach, someone has yet to demonstrate > > that this is actually a performance problem in the real world. ;-) > > I could be way wrong, but I would think that a database might mmap > discontiguous segments of memory. Perhaps someone familiar with > mysql/postgres/others might know if they would be a good benchmark. I'm not particularly ``familiar'' with postgres, but I did some performance tests on it a little while ago. Grepping through one of the traces just now, I found that database system made 139 calls to mmap(), and the maximum number of regions mapped at any given time was 39.[1] I don't have execution times for the mmap() calls in this trace anymore, but with 139 of them total, I'm sure the overhead is minimal. Nevertheless, it's certainly possible that a reasonable ``mmap-bound'' application could exist; I just don't think it's very likely. > Actually, relating to this, didn't phk request a VM function which would > remap a page (or contiguous segment of pages) to a new address which had > free space after it? I believe that he needed such a feature to > turbocharge realloc(). It sounds like the freelist mode of operation > would make that more feasible. What he requested (at least in the malloc.c comments) was the ability to do a virtual move of malloc's main directory so that it can be expanded without copying it to a new location. You can't do this with mmap() because there's no ``handle'' with which to refer to anonymous memory regions from userland, and there are problems with malloc using a file descriptor. In any case, this issue is orthogonal, since malloc only needs one such directory at a time. [1] This is very approximate because it doesn't count shared libraries, and the little awk script I wrote doesn't account for the possibility that postgres might unmap a smaller region than the one it mapped.