Re: why swap at all?

From: Nick Piggin
Date: Wed May 26 2004 - 03:47:34 EST


Buddy Lumpkin wrote:
No. I am not making any assertions whatsoever. I am just calling out that
systems that run happily from physical memory and are not in need of swap
should never sacrifice an ounce of performance for even drastic improvements
to swap performance. Swap is a band-aid for saving money on memory and a few
years ago, it allowed you to save a substantial amount of money.


Hi Buddy,
Even for systems that don't *need* the extra memory space, swap can
actually provide performance improvements by allowing unused memory
to be replaced with often-used memory.

For example, I have 57MB swapped right now. It allows me to instantly
grep the kernel tree. If I turned swap off, each grep would probably
take 30 seconds.

The VM doesn't always get it right, and to make matters worse, desktop
users don't appreciate their long running jobs finishing earlier, but
*hate* having to wait a few seconds for a window to appear if it hasn't
been used for 24 hours.

Whether the cost savings for utilizing swap vs buying more memory are
substantial as of late is subject to opinion, but I cannot think of a system
that I have sized in the last three years where swap was expected to be used
except in un-anticipated memory shortfalls. In fact, if I didn't plan to
store crash dumps on the swap device, I think I would have omitted swap all
together in many configurations.

I have worked at large fortune 500 companies with deep pockets though, so
this may not be the case for many. I make this point though because I think
if it isn't the case yet, it will be in the near future as memory becomes
even cheaper because the trend certainly exists.

As for your short, two sentence comment below, let me save you the energy of
insinuations and translate your message the way I read it:


[snip]

I think the comment was rather directed at a specific problem you
described:

> This of course doesn't address the VM paging storms that happen due to large
> amounts of file system writes. Once the pagecache fills up, dirty pages must
> be evicted from the pagecache so that new pages can be added to the
> pagecache.

This sounds like you are having a serious problem, and it would be
great if you could describe it in detail. kernel version, workload,
description of the system, vmstat output, etc.

Let's keep it nice.

Best regards
Nick
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/