|
CompilingAndUsingNew
Compiling and Using ramzswap (0.6 or newer)
It requires kernel version 2.6.28 or higher. Introductioncompcache-0.6 brings some new features which require some changes to the way you use it. Some of the new features include:
Its known to work on x86, x86_64 and ARM. DetailsCompiling
NOTE: ramzswap will work on kernels with or without this patch. Of course, this feature will be disabled if compiled against kernel without this patch. UsingAbove compilation gives following modules:
Following shows a typical sequence of steps for using ramzswap.
./load_modules 4 This creates 4 (uninitialized) devices: /dev/ramzswap{0,1,2,3}
Use rzscontrol utility to configure and initialize individual ramzswap devices. Example:rzscontrol /dev/ramzswap0 --init # uses default value of disksize_kbSee rzscontrol manpage for more details and examples.
swapon /dev/ramzswap2 # or any other initialized ramzswap device
rzscontrol /dev/ramzswap2 --stats
swapoff /dev/ramzswap2
rzscontrol /dev/ramzswap2 --reset
./unload_modules NOTE: You must issue reset after swapoff for any ramzswap device. The reset causes all the (per-device) memory to be freed and performs lots of cleanups. (ramzswap module unload calls reset for all initialized devices). Following state diagram shows various ramzswap device states. The rzscontrol utility sends various ioctls to the ramzswap module to get/set information about individual devices. In the following figure, ioctl(--blah) means action taken when 'rzscontrol /dev/ramzswapX --blah' is done for /dev/ramzswapX device.
Figure 1: ramzswap device states. * Changing memlimit for an active device is not yet implemented. Common Problems
The second system is the most dangerous system a man ever designs.... The general tendency is to over-design the second system, using all the ideas and frills that were cautiously sidetracked on the first one. F.P.Brooks, Jr. The Mythical Man-Month (1975) |
Sign in to add a comment
Per the wiki/manual "insmod ramzswap.ko NUM_DEVICES=4 # creates 4 uninitialized devices: /dev/ramzswap{0,1,2,3}"
Should probably read "insmod ramzswap.ko NUM_DEVICES=4 # creates 4 uninitialized devices: /dev/block/ramzswap{0,1,2,3}"
This is creating confusion for some users. Thanks
franklintitus: The location of these device nodes is somewhat distro dependent. On my fedora system, /dev/ramzswapX nodes are created. Probably I should add a note regarding other possible locations of these nodes like /dev/block/ramzswapX as you pointed out.
I can't seem to set the size of the compcache device. Is this expected?
memlimit_kb parameter is used only when backing_swap is used. If you don't want to provide any backing swap, then you must use disksize_kb instead.
BTW, disksize_kb is upper limit on uncompressed worth of data given device can hold. While, memlimit_kb is upper limit on compressed worth of data given device can hold.
I understand that specifying disksize_kb value as upper limit on uncompressed data size seems bit counter-intuitive but this is how it is... We need to present a "fixed-size" disk to kernel.
I'm trying to run Compcache with backing swap using a swap file instead of a swap partition. If I use a swap partition it works great. If I use the exact same commands but change the -b paramater to a swap file I am unable to swapon the ramzswap. rzscontrol does not give me an error (it does if I don't use a valid swap file but when I do it is ok). But when I use the swapon command it says "invalid argument". Can anyone help me on this?
MikeTaylor00?: I guess you have not done mkswap on the swapfile. Just fyi, to use 1G swapfile as backing swap, you would do:
(memlimit here ~40MB; shorter options -b, -m, -i will also work).
I have done mk swap. Here is what I did
If I use the exact same commands that I listed above but I use my linux-swap partition /dev/block/mmcblk0p3 it works like a champ.
I tried again, using file as backing swap works for me. Can you please submit an issue for this? Lets see whats happening in your case.
BTW, I am using this with my G1 Phone which is an ARM processor. Could there be something that CC expects differently about the swap file? Maybe the block size is an issue?
Should the user issue "rzscontrol --init" manually when the module is loaded? I found some comments from Ubuntu wiki and Gentoo bugzilla doesn't mention it.
KJackie: When the module is loaded, all /dev/ramzswapX devices are uninitialized. So, to initialize any device, say ramzswap0, you have to do 'rzscontrol /dev/ramzswap0 --init' for the device while also providing (optional) parameters like backing_swap etc.
Is there any reason why my swap devices are never used? I have a swappiness of 60 but free always reports 0 used space for Swap. It's not limited to compcache, but now that I got it working here I would like to fix it.
cjhard: Perhaps you are not filling your memory enough. Run memog or something to force system into swapping.