>>>> I wanted to know wether linux can instead of having a static
>>>> size swap have a dynamic size swap . That is if there is disk
>>>> space available that is there is no valid data , that could be
>>>> used for swap .
>>>> Static swap also has a problem that when I increase my ram the
>>>> swap also has to be increased for faster performance...
>> There's a common misconception that the swap space one needs is
>> exactly proportional to the amount of RAM one has, and this looks
>> like a classic example of that...
>> Can I state FROM EXPERIENCE that the so-called rule that swap
>> space should be 1.5 times RAM size is BOGUS!!! Some systems need
>> much more, others run happily on much less...
>> My experience has been that the following apply...
>> 1. All systems should have at least 4M of swap space, as Linux is
>> (or at least appears to be) less stable otherwise.
> I haven't ran all of the 2.2.x kernels, but I've ran practically
> every 2.0.x kernel, and many of those were with ample RAM and
> *NO* swap, with no instabilities.
I started with RedHat 4.1 running 2.0.27, then updated to 2.0.30 and
have run every kernel since, with 2.2.3 being the sole exception as
2.2.2 was current when I went on holiday and 2.2.4 was current when I
came back.
In all cases, I've tried them out on one system that only has 200 meg
of disk space and 32 meg of RAM, and unless I include the specified 4M
of swap, the system is very definately unstable. It's not X either as
I don't have X installed on the said system - it just sits there as my
network print server, doing nothing else.
I've never seen any swap in use on the said system, but the said
instability is very definately there...
>> 2. Where a system has multiple hard drives, Linux appears to be
>> more stable with a swap area on each drive than having some
>> drives with no swap area on them.
> Why? I've never encountered this.
I've no idea why, but I've now met that on three out of the four
systems I've installed Linux on that have multiple drives. The fourth
system was rock stable with just one drive with swap on it, hence my
use of "appears to be" in the text quoted...
>> 3. The sum of RAM and swap space should be at least 32M on a system
>> that is not running X, and at least 64M on a system that is
>> running X.
> I have a 486 set up as a simple firewall gateway with 8Mb RAM,
> and no swap. Runs and runs and runs. Never had it crash.
I've also had a system running with 5Mb RAM (4x1M + 4x256k SIMMs) and
no swap, so I know that such works, but in my experience, it ONLY
works in two situations:
1. A system that is dedicated to a small number of low memory
tasks. This includes both your firewall above, and my print
and DNS servers.
2. A system that has been seriously tuned by somebody who knows
exactly what they are doing.
The rule stated above is for a system that's likely to get a more
usual load than (1) and is unlikely to get (2).
>> 4. Too much swap space is not a problem, but too little swap
>> space really hurts.
> Yes, if you run apps that use more VM than you have configured.
Precicely.
>> 5. If the system in question regularly runs with more than 67% of
>> its swap space used, more swap space should be allocated.
>> Personally, I just allocate one 124M swap partition on each
>> drive installed, always as a primary partition, and leave it at
>> that. I've never had problems as a result of that policy, and
>> with modern 2G+ drives, the loss of 124M of data area per drive
>> isn't even noticed.
> Agreed. For a modern system with lots of disk space, a 124M
> partition per drive is an EXCELLENT idea indeed. I chuck them in
> extended partitions though.
I've had problems with swap partitions in extended partitions on
systems with both Linux and Win9x installed, usually as a result of
Win9x playing sillies, and my experience has been that the problems
occur only when there's an extended partition with both a Linux swap
partition and a partition of either type 6 or type B in it.
Since I regularly find my customers wanting to dual-boot Linux and
Win9x, and the setup I use requires at least one Win9x partition in an
extended partition, I avoid that problem by putting the swap partition
in a primary partition.
In fact, here's the layout I normally use, given a 4G+ drive:
Q> /dev/hda1 10M /boot
Q> /dev/hda2 C: /win/c
Q> /dev/hda3 124M (swap)
Q> /dev/hda4 (extended)
Q> /dev/hda5 350M D: /win/d
Q> /dev/hda6 150M /tmp
Q> /dev/hda7 200M /usr/local
Q> /dev/hda8 200M /root
Q> /dev/hda9 200M /var
Q> /dev/hda10 /home/ftp/pub
Q> /dev/hda11 /home/httpd
Q> /dev/hda12 /home
Q> /dev/hda13 /usr
Comments?
>>> If you need more swap space you can always swap to a file
>>> instead of a partition. The priority can be set so that it
>>> uses the swap partition first, then the swap file(s) for
>>> better performance.
>> I've never needed to do that, but can understand its use.
> I've done it a few times when my system slowed down and I checked
> free VM and found it steadily decreasing. I have a small script
> that I wrote, called "aswap" which functions more or less as "Oh
> shit, my system is running out of VM FAST! Make new swap space
> as fast as possible on the drive that has the most free space!"
>From experience, if you have /var as a separate partition, do NOT use
it for swap space. I've seen that done, with all free space in the
partition being allocated to swap files, and the resulting mess when
syslogd needed to expand /var/log/messages is undescribable!!!
> It searches ext2 drives first, followed by vfat, and finally
> msdos drives. Whichever has the most space gets the temp
> swapfile. Works great on the occasions I need it which are
> rare, and usually due to a Netscape or KDE memleak.
I don't use msdos drives, and have that file system disabled in the
kernels I compile, but if I came across the situation you mention, I
would do the same...
>>> IMHO, if you have unused space (non-partitioned) left on your
>>> hard disk, it is just being wasted.
>> True, but irrelevant - whether the space is unused because it
>> hasn't been partitioned, or unused because no use is being made
>> of the partition, it's still being wasted at that time.
> Unless it's being used to collect 0's. ;o)
LOL !!!
Best wishes from Riley.
+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/