Re: Tunning FreeeBSD and PostgreSQL - Mailing list pgsql-performance

From Bruce Momjian
Subject Re: Tunning FreeeBSD and PostgreSQL
Date
Msg-id 200307221729.h6MHT7M02341@candle.pha.pa.us
Whole thread Raw
In response to Re: Tunning FreeeBSD and PostgreSQL  (Vivek Khera <khera@kcilink.com>)
Responses Re: Tunning FreeeBSD and PostgreSQL
List pgsql-performance
Vivek Khera wrote:
> >>>>> "BM" == Bruce Momjian <pgman@candle.pha.pa.us> writes:
>
> >> not anything pre-allocated (from my understanding).  These settings
> >> allow for up to 100,000 shared buffers (I currently only use 30,000
> >> buffers)
>
> BM> I think the only downside to making them too big is that you allocate
> BM> page tables and prevent that address range from being used by other
>
> Does this apply in general or just on FreeBSD?

Let me tell you how it traditionally worked  --- each process has the
kernel address space accessible at a fixed address --- it has to so the
process can make kernel calls and run those kernel calls in its own
address space, though with a kernel stack and data space.

What they did with shared memory was to put shared memory in the same
address space with the kernel, because everyone had that address range
mapped into their address space already.  If each process had its own
private copy of the kernel page tables, there is bloat in having the
kernel address space be larger than required.  However, if the kernel
page tables are shared by all processes, then there isn't much bloat,
just less addressable user memory, and if you don't have anything near 4
gigs of RAM, it isn't a problem.

I know Linux has pagable shared memory, and you can resize the maximum
in a running kernel, so it seems they must have abandonded the linkage
between shared page tables and the kernel.  This looks interesting:

    http://www.linux-tutorial.info/cgi-bin/display.pl?312&0&0&0&3

and the Contents on the left show additional info like the i386 virtual
directory/page tables:

    http://www.linux-tutorial.info/cgi-bin/display.pl?261&0&0&0&3

So it seems Linux has moved in the direction of making shared memory act
just like ordinary allocated memory, except it is shared, meaning I
think each process has its own pages tables for the shared memory.  Once
you do that, you get the ability to size it however you want, but you
lose shared page tables, and it can now be swapped out, which can be bad
for performance.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-performance by date:

Previous
From: SZUCS Gábor
Date:
Subject: Re: Dual Xeon + HW RAID question
Next
From: "scott.marlowe"
Date:
Subject: Re: Tuning PostgreSQL