compcache

· by Gürkan · Read in about 1 min · (112 Words)

I've accidentally discovered this in kernel:

compcache [link] creates block devices like /dev/zram0, acting like a swap device. But it's using RAM actually, compressed. I can feel the difference on my 1gb-ram netbook a little. It's not a new project, I don't know how did I miss this. Setting up a "ramswap" is pretty easy. Here is my /etc/conf.d/local:  

local_start() {
modprobe zram num_devices=2
echo 67108864 > /sys/block/zram0/disksize
echo 67108864 > /sys/block/zram1/disksize
mkswap /dev/zram0
mkswap /dev/zram1
swapon /dev/zram0
swapon /dev/zram1
return 0 }

local_stop() {
swapoff /dev/zram0
swapoff /dev/zram1
echo 1 > /sys/block/zram0/reset
echo 1 > /sys/block/zram1/reset
return 0 }

I guess you got the message ;) #EDIT: conf.d/local, sorry for mistake