Date: Sat, 25 Oct 2003 23:56:21 -0700 From: David Schultz <das@FreeBSD.ORG> To: Mike Silbersack <silby@silby.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Some mmap observations compared to Linux 2.6/OpenBSD Message-ID: <20031026065621.GA21546@VARK.homeunix.com> In-Reply-To: <20031026005938.L2023@odysseus.silby.com> 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> <xzpk76sc425.fsf@dwp.des.no> <20031026052854.GA20701@VARK.homeunix.com> <20031026005938.L2023@odysseus.silby.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031026065621.GA21546>
