[CentOS] Swap Partition in CentOS 5.8

Mon Jun 18 23:55:53 UTC 2012
Woodchuck <marmot at pennswoods.net>

On Mon, Jun 18, 2012 at 06:30:28PM -0400, Christina Salls wrote:
> This is actually from RHEL admin guide but should be appropriate for CentOS
> as well:
> 

Let me un-windoze your table:  (you should consider using a text-based
mail agent on Unix lists).

<PRE>

Table 6.1. Recommended System Swap Space

Amount of RAM in the System     Recommended Amount of Swap Space
4GB of RAM or less              a minimum of 2GB of swap space
4GB to 16GB of RAM              a minimum of 4GB of swap space
16GB to 64GB of RAM             a minimum of 8GB of swap space
64GB to 256GB of RAM            a minimum of 16GB of swap space
256GB to 512GB of RAM           a minimum of 32GB of swap space

</PRE>

The problem with this -- it seems to assume that swap requirements
are based on system memory.  I'm not intimately familiar with the
Linux kernel, so I have a few questions: (These are T-F).

1) The linux kernel does not swap at all, but only pages. (Swap ==
copy entire image to disc, and suspend it.  Page == copy certain
memory pages to disc when core becomes exhausted.)

2) The linux kernel does not copy the entire image to the page file
to start execution. (This was done on some older OSes, one copied
the whole image to swap/page, then faulted the page with the entry
point, which got the ball rolling.  Initially this was a copy to
"drum" from tape or cards, but there was for a long time situations
with slow vs fast storage.)  Instead, pages are initially paged in
from the regular normal disc image of the program or from dynamic load
libraries.

3) The practical upper limit on swap [sic] file size are the page
maps in the kernel, (which map pages of VM to blocks in the swap file),
since these maps (naturally) cannot be paged.

4) Linux kernel memory may not be paged, any of it, ever.  (This
is true of some other systems.)

5) The amount of swap/page required in a system is a function of
the number and size of (pseudo)-simultaneously executing images.

6) The recommendations in the table are ad hoc estimates based
on questions (5) and (3) being answered "TRUE".

7) Memory-mapping a disc file with mmap(2) places no demand on
system page files.

8) The Linux kernel itself has no requirement at all for a page
file or partition.

Thanks to the list for any answers!

Dave
-- 
    Aristippus passed Diogenes as he was washing lentils.  He said,
    "If you could but learn to flatter the king, you would not have
    to live on lentils." Diogenes said, "And if you could learn to
    live on lentils, you would not have to flatter the king."