Re: Fw: [vorbis-dev] ogg123: shared memory by mmap() - Mailing list pgsql-hackers

From Alfred Perlstein
Subject Re: Fw: [vorbis-dev] ogg123: shared memory by mmap()
Date
Msg-id 20010319045500.T29888@fw.wintelcom.net
Whole thread Raw
In response to Fw: [vorbis-dev] ogg123: shared memory by mmap()  ("Rod Taylor" <rod.taylor@inquent.com>)
Responses Re: Fw: [vorbis-dev] ogg123: shared memory by mmap()  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
WOOT WOOT! DANGER WILL ROBINSON!

> ----- Original Message -----
> From: "Christian Weisgerber" <naddy@mips.inka.de>
> Newsgroups: list.vorbis.dev
> To: <vorbis-dev@xiph.org>
> Sent: Saturday, March 17, 2001 12:01 PM
> Subject: [vorbis-dev] ogg123: shared memory by mmap()
> 
> 
> > The patch below adds:
> >
> > - acinclude.m4:  A new macro A_FUNC_SMMAP to check that sharing
> pages
> >   through mmap() works.  This is taken from Joerg Schilling's star.
> > - configure.in:  A_FUNC_SMMAP
> > - ogg123/buffer.c:  If we have a working mmap(), use it to create
> >   a region of shared memory instead of using System V IPC.
> >
> > Works on BSD.  Should also work on SVR4 and offspring (Solaris),
> > and Linux.

This is a really bad idea performance wise.  Solaris has a special
code path for SYSV shared memory that doesn't require tons of swap
tracking structures per-page/per-process.  FreeBSD also has this
optimization (it's off by default, but should work since FreeBSD
4.2 via the sysctl kern.ipc.shm_use_phys=1)

Both OS's use a trick of making the pages non-pageable, this allows
signifigant savings in kernel space required for each attached
process, as well as the use of large pages which reduce the amount
of TLB faults your processes will incurr.

Anyhow, if you could make this a runtime option it wouldn't be so
evil, but as a compile time option, it's a really bad idea for
Solaris and FreeBSD.

--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]


pgsql-hackers by date:

Previous
From: "Rod Taylor"
Date:
Subject: Fw: [vorbis-dev] ogg123: shared memory by mmap()
Next
From: Bruce Momjian
Date:
Subject: Re: Re: pg_upgrade