jam <j...@tigger.ws> writes:
> On Sunday 19 April 2009 00:16:35 slug-requ...@slug.org.au wrote:
>
>> I've decided to increase the RAM on my home CentOS server. As best I
>> can recall, the accepted wisdom is to have SWAP approx.~ 2 x RAM. Or
>> was that approx.~ 50% of RAM?
>>
>> Can someone point me in the direction of an explicit tutorial on how
>> I might go about increasing SWAP without destroying data on my other
>> partitions please?
>>
>> Or if I'm actually upping the RAM, should I just not worry about it?
>>
>> Info I'm guessing would be relevant;
>
> Of course this is cockamany, urban myth, etc and typically you
> increase RAM and need even less swap than before

Actually, back in the day this was a good and solid guide, both for
performance and safety reasons.  Today, less so, but I don't think it is
quite as laughable or untrue as you suggest.

[...]

> EXCEPT for 1 tragic circumstance: Never *suspend* unless you have as
> much SWAP as RAM.

You mean suspend to disk, not suspend to RAM, right?  Swap is irrelevant
to the later, and the amount you need varies with which of the three
implementations of the former you choose.

However, all of them require as much swap as you have *active memory*,
not as much as RAM — although, obviously, if you have no discardable
pages[1] then you need the two to be equal.

> Suspend writes all RAM starting at the beginning of swap and over
> everything along the way.

No, it doesn't.  It uses the swap storage space just like the normal
kernel, except for adding some private accounting information and a
different header to make it possible to detect that it was used to
suspend to disk.

If it behaved as you describe[2] then it would corrupt memory on the way
through as it overwrote swapped data (and, then, no one would ever
report a successful suspend to disk. :)

Regards,
        Daniel

Footnotes: 
[1]  You do, in the form of all executable code, disk backed memory
     mappings, disk cache and so forth.  In fact, it is quite rare that
     discardable memory doesn't represent a substantial portion of your
     used memory, even if swap is in use.

[2]  Excluding the obvious circumstance of bugs in the suspend software
     that cause it to create serious corruption, which you may have
     encountered, especially with the more experimental versions.

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to