This is a discussion on slackware-current not using swap? within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> On Thu, 13 May 2004 01:49:26 -0800, Floyd L. Davidson wrote: > Incidentally, I've just upgraded two machines from ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Thu, 13 May 2004 01:49:26 -0800, Floyd L. Davidson wrote: > Incidentally, I've just upgraded two machines from 2.6.0 to > 2.6.6, and the first of them has been up for a day and a half > now, and has yet to use 1 byte of swap. Mighty suspicious... > > If, by tomorrow, nothing gets paged out just because it was > sleeping too long I'll probably back off to 2.6.5 to see if that > changes. > Hello Floyd, I use 2.6.5 on my 9.1 (regular version) and it uses no swap even under stress. Recently I downloaded a rather huge file (700 megs). I used the KDE Info center application to watch the behavior of memory and swap usage while the download was in progress. At about 500 megabytes downloaded, memory had been almost totally exhausted but no swap was in use. The last 200 megabytes of the download took place with only about 5 megabytes of memory free and the machine seemed to operate quite happily on that basis. The download completed OK with no apparent speed differences along the way. The memory seemed to be exhausted by way of the disk cache just expanding and expanding. My machine has 512 megabytes of memory installed and has a 1 gigabyte swap file on a separate logical partition on a separate physical drive. It operates normally with about 250 megabytes of free physical memory and no swap in use. It seems strange, no swap in use. That *other* operating system uses swap almost continuously so performance improves significantly if you place swap on a separate channel. Maybe we need Linus to step in here and explain how the memory management subsystem works. :-) Linux seems to purr like a kitten though, regardless of not using swap. -- John |
| ||||
| John <John@somewhere.com> wrote: >On Thu, 13 May 2004 01:49:26 -0800, Floyd L. Davidson wrote: > >> Incidentally, I've just upgraded two machines from 2.6.0 to >> 2.6.6, and the first of them has been up for a day and a half >> now, and has yet to use 1 byte of swap. Mighty suspicious... >> >> If, by tomorrow, nothing gets paged out just because it was >> sleeping too long I'll probably back off to 2.6.5 to see if that >> changes. >> > >Hello Floyd, > >I use 2.6.5 on my 9.1 (regular version) and it uses no swap even under >stress. Recently I downloaded a rather huge file (700 megs). I used the >KDE Info center application to watch the behavior of memory and swap usage >while the download was in progress. At about 500 megabytes downloaded, >memory had been almost totally exhausted but no swap was in use. The last >200 megabytes of the download took place with only about 5 megabytes of >memory free and the machine seemed to operate quite happily on that basis. A download only stresses the disk caching/buffering system. That will *never* cause the system to swap a running process. It merely uses up all "free" RAM and then does all disk IO directly to the disk (or, more correctly it just flushes the oldest data from RAM). >The download completed OK with no apparent speed differences along the >way. The memory seemed to be exhausted by way of the disk cache just >expanding and expanding. > >My machine has 512 megabytes of memory installed and has a 1 gigabyte swap >file on a separate logical partition on a separate physical drive. It >operates normally with about 250 megabytes of free physical memory and no >swap in use. But do you mean 250Mb of memory allocated to processes, or to disk caching? The disk cache just uses everything that isn't allocated to processes; but when more memory is needed for process allocations, the disk cache is discarded to provide that memory. >It seems strange, no swap in use. That *other* operating system uses swap >almost continuously so performance improves significantly if you place >swap on a separate channel. Maybe we need Linus to step in here and >explain how the memory management subsystem works. :-) It's fairly well known and well documented. Generally what you want is enough physical RAM that /running/ processes don't commonly end up being paged to the swap space. With RAM as cheap as it is today, that can often mean simply that you really do have enough RAM that the system *never* pages a running process. (When RAM was expensive the idea was to figure out what it usually needed, and then add enough swap to cover the rare occasions when it used more than that.) Now days however the idea is more often to put in enough RAM that the system can have a significant amount of disk cache during normal operation, and that is usually far more than is ever actually used by processes. For example, you might find it relatively difficult to actually use up 512Mb of RAM for processes. Try viewing many instances of a very large image file... The only actual process swapping that you ever want to see (and you probably *do* want to see this) is for "old" processes that are essentially sleeping forever. For example, most distributions run agetty on 6 of 7 virtual consoles, and run X on the 7th. If you login with X, there are 6 (or 5 if you log into a VC and then start X) instances of agetty that have simply gone to sleep and likely will never become an active process again. So Linux does (or can do) a fairly reasonable thing, which is to swap out those sleeping processes... thus making more RAM available for use by the disk cache! Hence you probably do want some swapping to show up after a day or two since the system has been rebooted. >Linux seems to purr like a kitten though, regardless of not using swap. Unless you are shutting it off (an abomination in itself), you want to see it use a little swap for those sleeping processes. The willingness to swap out processes is controlled by /proc/sys/vm/swapiness, which by default is set to 60, and with it set there, with 2.6.6 hadn't swapped anything out in a day and half or two days for me. I wrote "100" to that file, and fixed my boot rc scripts to do it every time, and within a very short time it swapped out all of the sleeping processes. I'm not sure exactly what all changed between 2.6.0 and 2.6.6, or precisely when it changed, but I had not done the above with the 2.6.0 kernel. I'm sure it is well documented in the kernel change log, but it doesn't seem worth the effort to look it up at the moment... :-) -- Floyd L. Davidson <http://web.newsguy.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) floyd@barrow.com |