Re: Pre-allocation of shared memory ...

From: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
To: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Pre-allocation of shared memory ...
Date: 2003-06-13 19:29:03
Message-ID: 200306131529.03944.lamar.owen@wgcr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday 13 June 2003 12:46, Nigel J. Andrews wrote:
> On Fri, 13 Jun 2003, Lamar Owen wrote:
> > Incidentally, Red Hat as of about 7.0 began insisting on swap space at
> > least as large as twice RAM size. In my case on my 512MB RAM notebook,
> > that meant it wanted 1GB swap. If you upgrade your RAM you could get
> > into trouble. In that case, you create a swap file on one of your other
> > partitions that the kernel can use.

> I'm not sure I agree with this. To a large extent these days of cheap
> memory swap space is there to give you time to notice the excessive use of
> it and repair the system, since you'd normally be running everything in
> RAM.

It is or was a Linux kernel problem. The 2.2 kernel required double swap
space, even though it wasn't well documented. Early 2.4 kernels also
required double swap space, and it was better documented. Current Red Hat
2.4 kernels, I'm not sure which VM system is in use. The old VM certainly
DID require double physical memory swap space.

From a message I wrote in January of 2002:
"On Tuesday 22 January 2002 03:48 pm, Jim Wilcoxson wrote:
> I should have said, we're running this way on 2.2.19, not 2.4 -J

> > Is this Linux requirement documented anywhere? We're running 256MB
> > of swap on 1GB machines and have not had any problems. But we don't
> > swap much either.

2.2 actually needs 2x swap, but the problems are worse with 2.4. 2.2 won't
die a horrible screaming death -- but 2.4 WILL DIE if you run out of swap in
the wrong way. As to documentation, I can't tell you how I found out about
it, as I'm under NDA from that source.

However, it is public information: see http://lwn.net/2001/0607/kernel.php3
for some pointers. Also see
http://www.geocrawler.com/archives/3/84/2001/5/0/5867356/
http://www.tuxedo.org/~esr/writings/ultimate-linux-box/configuration.html
and
http://www.ultraviolet.org/mail-archives/linux-kernel.2001/28831.html

And note that Red Hat Linux 7.1 and 7.2 will complain vociferously if you
create a swap partition smaller than 2x RAM during installation (anaconda).
What it doesn't do is complain when you upgrade RAM but don't upgrade your
swap."

Now, as to whether this is _still_ a requirement or not, I don't know. Search
the lkml (Linux Kernel Mailing List) for it.

However, understand that the Red Hat kernel is closer to an Alan Cox kernel
than to a Linus kernel. At least that was true up to 2.4.18; the Red Hat
2.4.20 is very different, with NPTL and its ilk thrown in.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Benjamin Minshall 2003-06-13 19:34:04 Multi-Table Indexes
Previous Message Jeroen T. Vermeulen 2003-06-13 19:18:51 Re: Pre-allocation of shared memory ...