Compiling and using compcacheHelp on using out-of-tree compcache modules. If you are using compcache kernel patches then refer Patches.
You require Linux kernel 2.6.x to compile these modules. - Checkout the source or download tarball from here.
- Compile:
- run 'make' in directory where you checked-out or untar'ed sources.
- Usage:
- Loading: run 'use_compcache.sh <size of swap device (KB)>' to load all required modules and setup swap device. If size is not specified, default size of 25% of RAM is used.
- Unloading: run 'unuse_compcache.sh' to unload all modules and turn-off compcache swap device.
If you get any problem using (un)use_compcache scripts, you can do these steps manually as: - Load kernel modules:
- 4 kernel modules are created on compiling. You need to load all three of them (compcache.ko at last)
- insmod lzo1x_compress.ko
- insmod lzo1x_decompress.ko
- insmod tlsf.ko
- insmod compcache.ko compcache_size_kbytes=5120 (compcache_size_kbytes param sets maximum size allocated for compressed pages)
- device node /dev/ramzswap0 should be automatically created after loading compcache module. If not, then manually create it as:
- mknod /dev/ramzswap0 b 253 0 (replace 253 with whatever major no. is assigned to this device: cat /proc/device | grep ramzswap)
- Add ramzswap as swap device
- swapon /dev/ramzswap0 -p 1 (give this swap device the highest priority).
- Verify that ramzswap is active using: cat /proc/swaps. Its should show entry of /dev/ramzswap0.
Now, when system starts swapping, compcache will compress and store these pages in RAM itself! :)
|
I'm trying on an CentOS 4 box (2.6.9) and found that it actually needs Linux kernel 2.6.17+ for the mutex API used.
Please add comments regarding compilation issues only. For other things, please use mailing list and issue tracker.
Hi, is there a way how to find out the efficiency? like compress ratio of data stored in that virtual swap disc? Or do you have any statistic on usual efficiency?
tiborb95: /proc/compcache gives idea on compression efficiency and /proc/tlsfinfo for storage stats. For other data, just explore this site.
Hello,
/usr/src/compcache-0.4/sub-projects/allocators/tlsf-kmod/tlsf.c: In function `tlsf_destroy_memory_pool': /usr/src/compcache-0.4/sub-projects/allocators/tlsf-kmod/tlsf.c:448: warning: implicit declaration of function `pr_warning'
[ 3360.755026] tlsf: Unknown symbol pr_warning [ 3360.877490] compcache: Unknown symbol tlsf_free [ 3360.877732] compcache: Unknown symbol tlsf_malloc [ 3360.877891] compcache: Unknown symbol tlsf_destroy_memory_pool [ 3360.878040] compcache: Unknown symbol tlsf_create_memory_pool
Ok to fix the tlsf "unknown symbol" problem,
just add the following line to sub-projects/allocators/tlsf-kmod/tlsf.c
#include "compat.h"
Fixed in SVN rev #170. Thanks for pointing this out.
i compiled it on 2.6.9 but there is no mutex.h in it ...i found its there in 2.6.24 but not in 2.6.9 but you wrote it will compile well on all 2.6.