What's new? | Help | Directory | Sign in
Google
                
Search
for
Updated Jul 17, 2008 by nitingupta910
Labels: Featured, Phase-Deploy
CompilingAndUsing  

Compiling and using compcache

Help 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.

  1. Checkout the source or download tarball from here.
  2. Compile:
    • run 'make' in directory where you checked-out or untar'ed sources.
  3. 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! :)


Comment by yuanchao, Feb 20, 2008

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.

Comment by nitingupta910, Mar 16, 2008

Please add comments regarding compilation issues only. For other things, please use mailing list and issue tracker.

Comment by tiborb95, Aug 20, 2008

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?

Comment by nitingupta910, Aug 20, 2008

tiborb95: /proc/compcache gives idea on compression efficiency and /proc/tlsfinfo for storage stats. For other data, just explore this site.

Comment by olivier.kaloudoff, Aug 26, 2008

Hello,

compilation on 2.6.20.3-ubuntu1 (on powerpc g4) succeeds with the following warnings;
CC M? /usr/src/compcache-0.4/sub-projects/allocators/tlsf-kmod/tlsf.o

/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'

But using compcache fails with the following messages in dmesg;

[ 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

Comment by olivier.kaloudoff, Aug 27, 2008

Ok to fix the tlsf "unknown symbol" problem,

just add the following line to sub-projects/allocators/tlsf-kmod/tlsf.c

#include "compat.h"

Comment by nitingupta910, Aug 27, 2008

Fixed in SVN rev #170. Thanks for pointing this out.

Comment by nidhimittal19, Oct 30, 2008

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.


Sign in to add a comment