Suggestion for Documentation/memory.txt

Thomas Koenig (ig25@mvmap66.ciw.uni-karlsruhe.de)
Fri, 25 Apr 1997 16:50:52 +0200 (MET DST)


Here's a draft for a Documentation/memory.txt (or possibly
Documentation/memory-tuning.txt).

Comments?

There are several files in /proc/sys/vm you can use to tune the
memory system with.

You can look at them with cat, and set them by echo, for example:

echo 128 256 512 > /proc/sys/vm/freepages

/proc/sys/vm/freepages:

This contains three consecurive numbers: min_free_pages, free_pages_low
and free_pages_high.

Free memory never goes down below min_free_pages except for atomic
allocation. Background swapping is started if the number of free
pages falls below free_pages_high, and intensive swapping is started
below free_pages_low. A "page" is 4 kB.

If "out of memory" errors sometimes occur, or if your machine does lots
of networking, increasing min_free_pages to 64 or more may be a good
idea.

free_pages_low should probably be about double of min_free_pages.

After a period of inactivity, the difference between free_pages_high and
free_pages low is immediately available for any program you want to
start up, without any need to swap out anything else. If your memory
is large enough (e.g. > 16 Meg), keeping 2 or 3 megabytes of memory
ready for anything that might start up is probably a good idea.

I've found that

echo 128 256 1024 > /proc/sys/vm/freepages

gives good performance for a 32 Meg system used as a small server and
personal workstation.

The other two files in /proc/sys/vm are undocumented, as yet.

-- 
Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.