Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Does anyone here use Compcache?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Tue Apr 27, 2010 12:39 am    Post subject: Does anyone here use Compcache? Reply with quote

http://lwn.net/Articles/334649/
http://code.google.com/p/compcache/wiki/CompilingAndUsingNew
https://bugs.gentoo.org/252987

Is anyone using Compcache? I am tempted to try it on my virtual machines.
Back to top
View user's profile Send private message
tranquilcool
Veteran
Veteran


Joined: 25 Mar 2005
Posts: 1159

PostPosted: Tue Apr 27, 2010 3:18 am    Post subject: Reply with quote

using it and seems to be working.
_________________
this is a strange strange world.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5720

PostPosted: Tue Apr 27, 2010 7:47 am    Post subject: Reply with quote

Using it for over a year now. Nice to see the average user has access to it with 2.6.33.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2273
Location: Bardowick, Germany

PostPosted: Wed Apr 28, 2010 10:55 am    Post subject: Reply with quote

After noticing this thread yesterday, I am testing/using compcache now.

For those who like to try it out, here is my installation path: (Which may be wrong, ineffective, incomplete and so on, and bears no guarantee!)
  1. Enable RAMZ in Kernel-config:
    Code:
    Location:
         -> Device Drivers
           -> Staging drivers (STAGING [=y])
             -> Exclude Staging drivers from being built (STAGING_EXCLUDE_BUILD [=n])
               -> Compressed in-memory swap device (ramzswap) (RAMZSWAP [=m])
    or:
    sed-notebook linux # grep RAMZ .config
    CONFIG_RAMZSWAP=m
    CONFIG_RAMZSWAP_STATS=y
  2. unmask sys-block/compcache-tools-0.6 (it can be found in the sunrise overlay) and emerge it.
  3. As I have 1GB of RAM, I decided to set up 4 ram devices with 64MB size each. Using Baselayout2, I edited local.start and local.conf:

    /etc/conf.d/local.start
    Code:
    modprobe ramzswap num_devices=4

    rzscontrol /dev/ramzswap0 -d 65536 -i
    rzscontrol /dev/ramzswap1 -d 65536 -i
    rzscontrol /dev/ramzswap2 -d 65536 -i
    rzscontrol /dev/ramzswap3 -d 65536 -i

    swapon -p 666 /dev/ramzswap0
    swapon -p 666 /dev/ramzswap1
    swapon -p 666 /dev/ramzswap2
    swapon -p 666 /dev/ramzswap3
    /etc/conf.d/local.stop
    Code:
    swapoff /dev/ramzswap3
    swapoff /dev/ramzswap2
    swapoff /dev/ramzswap1
    swapoff /dev/ramzswap0

    rzscontrol /dev/ramzswap3 --reset
    rzscontrol /dev/ramzswap2 --reset
    rzscontrol /dev/ramzswap1 --reset
    rzscontrol /dev/ramzswap0 --reset
  4. reboot
  5. test whether it works:
    Code:
    sed-notebook linux # cat /proc/swaps
    Filename                                Type            Size    Used    Priority
    /dev/sda5                               partition       2096436 0       -1
    /dev/ramzswap0                          partition       65528   45124   666
    /dev/ramzswap1                          partition       65528   45044   666
    /dev/ramzswap2                          partition       65528   45004   666
    /dev/ramzswap3                          partition       65528   45100   666
right now it looks like its working...

I'll report back after some more usage.

Edit: And once I have tested the compache-0.6.2 ebuild from bugs.gentoo.org

Edit 2: Wooohooo! And now please forget everything I've written above, and simply use the ebuild from https://bugs.gentoo.org/show_bug.cgi?id=252987 ! (Plus the init.d and conf.d patches of course)

Enabling the staging driver and building ramzswap.ko is still required, of course, but with this ebuild it works like a charm!

(gentoo-sources-2.6.33-r1 on amd64 used here)
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2273
Location: Bardowick, Germany

PostPosted: Fri Apr 30, 2010 12:10 pm    Post subject: Reply with quote

Now running for 2 days, and I have not witnessed any problems.

Stats:
Code:
sed@sed-notebook ~ $ uptime
 14:10:18 up 2 days, 0 min,  6 users,  load average: 0.90, 0.84, 0.76
sed@sed-notebook ~ $ cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/ramzswap0                          partition       65528   65508   -1
/dev/ramzswap1                          partition       65528   65408   -2
/dev/ramzswap2                          partition       65528   65400   -3
/dev/ramzswap3                          partition       65528   65284   -4
/dev/sda5                               partition       2096436 186732  -5

_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
mikegpitt
Advocate
Advocate


Joined: 22 May 2004
Posts: 3221

PostPosted: Mon May 03, 2010 6:55 pm    Post subject: Reply with quote

I've never heard of it until now, but it looks interesting. My machine rarely swaps things to disk, but it still seems like it would be worthwhile to enable.
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Mon May 24, 2010 11:18 am    Post subject: Reply with quote

The Linux Kernel 2.6.34 is out and since compcache is supposed to be mature in 2.6.34 as far as its developers' wiki is concerned, I am trying it out. My first observation is that the ebuild for version 0.6 in sunrise is much better written than the proposed ebuild for 0.6.2 in the bug tracker. A version bump appears to be all that is needed to make it work with 0.6.2.

I ran the following and so far so good:

Code:
modprobe lzo_compress
modprobe lzo_decompress
modprobe ramzswap
swapoff /dev/sda2
rzscontrol /dev/ramzswap0 --memlimit_kb=2097152 --disksize_kb=2097152 --backing_swap=/dev/sda2 --init
swapon /dev/ramzswap0


Does anyone know if it is possible to modify fstab to mount a ramzswap device at boot or is it necessary to use a custom init script? Also, does anyone know if this works with suspend to disk?
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Mon May 24, 2010 1:40 pm    Post subject: Reply with quote

I seem to have found an issue with compcache:

Code:
# rzscontrol /dev/ramzswap0 -sv
BackingSwap:    /dev/sda2
DiskSize:        2097152 kB
MemLimit:        2097152 kB
NumReads:         150701
NumWrites:        480010
FailedReads:           0
FailedWrites:          0
InvalidIO:             0
NotifyFree:            0
ZeroPages:          2189
GoodCompress:        100 %
NoCompress:            0 %
PagesStored:      244347
PagesUsed:         80631
OrigDataSize:     977388 kB
ComprDataSize:    312024 kB
MemUsedTotal:     322524 kB
BDevNumReads:     114250
BDevNumWrites:    233474


Code:
# free
             total       used       free     shared    buffers     cached
Mem:       2074120    1431060     643060          0      87984     791624
-/+ buffers/cache:     551452    1522668
Swap:      2097148     239764    1857384


That is after having rebuilt my part of my system with +nls. It is clearly not freeing pages that are no longer being used, which is an analogous issue to what happens with pages on SSDs. I imagine that this could be fixed by implementing TRIM support in the Linux kernel swap implementation, compcache's block device and for completeness, in the functions where compcache interacts with the actual swap file. There appears to be have been some patch that did something along these lines (although it was not TRIM), but for whatever reason, it was never merged into 2.6.34:

http://lwn.net/Articles/386299/
http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.34

Does anyone have any idea how difficult would it be to implement TRIM support ourselves? I know that there are patches that were proposed to fix this, but they seem hackish given that this functionality is supposed to be encapsulated into a block device such that all communication between it and the kernel is done via block interfaces and the way that I understand that the patches work bypasses encapsulation to enable pages to be freed from memory.

Edit: I am reading the discussion on the kernel mailing list:

http://thread.gmane.org/gmane.linux.kernel/981457

It seems that Linus Torvalds had the same thought I had about having this work via TRIM, except he thinks a bit differently about TRIM than I do:

Linus Torvalds wrote:
In fact, for regular block devices, a swap block free might well translate
into a TRIM command some day (where "some day" means when the SSD's
actually get their stuff together and there is real upside and not just
"most cases will be very slow and the upside is debatable").


Some SSDs have excellent TRIM support, so I am not sure whether he is referring to those or is referring to all of the ones that either lack TRIM support or lack good TRIM support.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum