ramdisk swapForum: DSL Tips and Tricks Topic: ramdisk swap started by: John Posted by John on May 03 2007,07:42
I've been experimenting with making a swap file in ram and Ive found that it pushes back the lockup point on computers without a swap partition and limited ram -- like my eBox that I use as my home computer. Usually it locks up at 50% memory usage, but if I create a small swap file it can go all the way up to 90% usage before it locks up. What's interesting is that I am not able to make a swap partition from within the /ramdisk/ directory. But it works fine outside of it.Here is the simple technique: cd / dd if=/dev/zero of=swapfile bs=4096 count=500 mkswap swapfile swapon swapfile That gives me a tiny swap file of just 2MB. It doesn't seem like it would make any difference, but I guess this has to do with the way the kernel handles memory allocation. It seems to get tripped when it hits the point where it would start engaging swap and its not there. Posted by mikshaw on May 03 2007,15:19
I never would have thought creating a swap file in ram would have any benefit at all, and in fact I've said that in response to a DSL user wanting to do this quite a while ago. Shows how assuming really can be a bad thing =o)
Posted by WDef on May 03 2007,21:27
There was a heated thread on this very topic on the kerneltrap.org forum, people arguing either that a ram swap made no sense, and otoh people saying that the linux kernel was designed to find and use swap and so would rather have a ram swap than none at all.Looks like John's proved which side was right, at least on his system. Posted by meo on May 04 2007,18:30
Hi there!I'm using it now and it seems to work just fine. It seems to save actual ram space so it looks like a good idea. As always have fun with DSL, meo |