[CentOS] Changing the size of the swap memory

Thu Jul 21 09:54:06 UTC 2011
Peter Kjellström <cap at nsc.liu.se>

On Thursday, July 07, 2011 03:57:04 PM Brunner, Brian T. wrote:
> centos-bounces at centos.org wrote:
> > On 07/06/11 5:40 PM, John J. Boyer wrote:
> >> When I first installed my CentOS system the machine had only 1 GB.
> >> the swap memory was set to 2 GB Now the machine has 4 GB but swap is
> >> still 2 GB. With that much memory maybe it doesn't matter, but it
> >> sure looks odd. Is there any way to change it?
> > 
> > add another swap extent via the swapon(8) command.
> > 
> > but, 2gb is plenty of swap for a 4gb system, anyone who
> > insists on swap
> > 
> >  >= physical memory is smoking something left over from the 1970s.
> 
> This is true both literally and figuratively.

Actually there are cases where you do want swap ~= physical (even though you 
wont be "using it". For example, if you need to increase the ulimit for stack 
size (some apps need this) then for a normal fork the kernel will need (free 
phys + free swap) > this.

So in the end you'll need a bit more swap then your required stack size limit.

Worth noting is that if you set it to unlimited then you don't need to reserve 
any swap for it...

/Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.centos.org/pipermail/centos/attachments/20110721/ab7625ee/attachment-0005.sig>