What would you count as available swap?

Nick Holloway (Nick.Holloway@alfie.demon.co.uk)
28 Apr 1996 09:55:17 +0100


I'm just updating swapd (daemon to dynamically add/remove swap
files to try and deal with peak VM usage) to deal with the new format
/proc/meminfo, and this has lead me to think about what it should count
as available VM.

The easy figures are "FreeMem:" and "FreeSwap:". These are definitely
available for use as VM.

The previous version of swapd (for a 1.2 kernel) would also count
"buffers" as being potential VM, since they could be discarded.

But, I don't feel that putting off adding another swap file would be a
good idea, since this could lead to thrashing of the available memory,
rather than allowing unused pages to be flushed to swap.

So, what do you think is a reasonable approximation to guestimating the
amount of swap available is? I guess the question is swapd will use
the following:

FreeVM = FreeMem + FreeSwap + ( Buffers + Cached ) * f

But what value should 'f' have? Is this 0, 0.5, or 1?

-- 
 `O O'  | Home: Nick.Holloway@alfie.demon.co.uk
// ^ \\ | Work: Nick.Holloway@parallax.co.uk  http://www.parallax.co.uk/~alfie/