CM7 - Swap? Compcache? Both?

Discussion in 'Cyanogenmod' started by chmcclellan, Feb 5, 2011.

  1. GodfatherIP

    GodfatherIP Member

    Joined:
    Feb 22, 2010
    Messages:
    248
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    I got link2sd working, it wasn't detecting the partition for some reason so it wasn't mounting it, I found some good info here. Basically I had to go into terminal and make a /data/sdext2 directory and then I added a script in /system/etc/init.d that mounted my sdcard partition each time my phone boots up. Now I can move individual apps over. I am just now testing it out but hopefully it will go smoothly now.

    The script created was 99complete in /system/etc/init.d and it contained the following code copied from the post I linked above:

    #!/system/bin/sh

    sync;
    setprop lk.filesystem.ready 1;

    # special case for Link2SD
    remount rw
    mkdir /data/sdext2
    mount -o rw,nosuid,nodev,noatime,nodiratime /dev/block/vold/179:2 /data/sdext2
    remount ro

    I'm not sure if some of the lines are needed (like do you need to run mkdir on every boot) but it seems to be working for me so I'll leave it alone for now.

    Update:

    I have moved over a bunch of my apps and everything seems to be working great. I kept apps like gmail, handcent, and apps with widgets on the sd card and moved most everything else over to the sd card. It is so nice not to have games taking up huge chunks of my rom and now I can use any of my apps even with the main sd partition mounted by the pc unlike the normal apps2sd implementation. I'm using an ext2 partition but apparently Link2sd supports ext3 and ext4 now so I may look into repartitioning with one of these newer file systems although I don't know if there would be much benefit (possibly faster?). Maybe someone with more linux knowledge like Prime could tell me if that would even be worth the trouble. Also I know the kernel supports ext3 (since I used it with simple2ext) but does it also support ext4? I guess since ext4 is the newest format some roms/kernels support it and others don't.

    If anyone wants to use Link2sd and wants more of a step by step guide to get it working on the Droid I can go into more detail.
     
    #37 GodfatherIP, Feb 24, 2011
    Last edited: Feb 25, 2011
  2. boristhebladexx

    Joined:
    Nov 26, 2009
    Messages:
    116
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Connecticut
    Ratings:
    +0
    10PM can't come soon enough now i need to get out of work and try this... CM7 with the reprimed kernel and compcache was still DREADFULLY slow on my D1 and homescreen redraw was an every app occurence
     
  3. prime

    prime Kernel Developer
    Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,934
    Likes Received:
    71
    Trophy Points:
    143
    Location:
    Florida
    Ratings:
    +74
    Or you could try deprimed with zram swap, if it gets sluggish simply type (in a su terminal) 'compcache stop && handle_compcache'...no need to redo your card.
     
  4. boristhebladexx

    Joined:
    Nov 26, 2009
    Messages:
    116
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Connecticut
    Ratings:
    +0
    id never done anything to my card, i was under the impression that swap was separate from compcache and had to be enabled differently. i was never using aps2ext or ever made a partition using ROM manager

    Sent from my Droid using DroidForums App
     
  5. GodfatherIP

    GodfatherIP Member

    Joined:
    Feb 22, 2010
    Messages:
    248
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    Yes swap is different from compcache and can be enabled with or without an sd card partition. Swapper2 will set up a swap on your sdcard and can use a partition or just a file on the main partition. Compcache compresses part of your phones ram and "swaps" things in and out of this compressed ram. It is a feature in CM7 and Prime has done a great deal of work on creating kernels with working compcache and has a new kernel with something called zram, which I don't know much about. They are all efforts to increase the phone's ram.

    The apps2sdext is a separate issue and I guess I sort of segued into it from the sd card partitioning for swap space, sorry if I created confusion by discussing apps2sdext in the compcache/swap thread.
     
  6. kevdog

    kevdog Member

    Joined:
    Nov 14, 2009
    Messages:
    722
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    GodFatherIP

    Alot of nice work you have been doing. Anyway you could set up a more detailed tut for us? Its great what you have been doing. Did you have to totally format your sdcard and set up the partitions during the format? Does each partition have a different journaling system (ie ext2 vs 3 or 4?).
     
  7. prime

    prime Kernel Developer
    Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,934
    Likes Received:
    71
    Trophy Points:
    143
    Location:
    Florida
    Ratings:
    +74
    You don't have to partition the drive, if you do the first partition should be primary fat32, the second also primary but should be ext2.
     
  8. tharris297

    tharris297 New Member

    Joined:
    Sep 12, 2010
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    prime .... if I have my SD card formated with fat/swap/ext3 ... if I enable compcache (CM7_RC2 and deprimed #14) will compcache use both RAM and Swap partition? You statement that you can use compcache with a swp partition with out issue is interesting.

    I am going to google compcache and may find the answer, but you are such a knowledge base. Virtual human library on kernel and the linux/android system.
     
  9. tharris297

    tharris297 New Member

    Joined:
    Sep 12, 2010
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0

    I did some googling and found the following that explained it all. I now have 2 swaps going. How do you use Compcache with linux-swap as a backup - xda-developers

    I also got a better understanding of VM and swappiness here: Tales from responsivenessland: why Linux feels slow, and how to fix that — Rudd-O.com

    Compcache zram0 is priority 1 and my swap partition (backswapping) is priority 2 ... now to work on tuning it is going to be the fun part
     
    #45 tharris297, Mar 13, 2011
    Last edited: Mar 13, 2011
  10. DigiK

    DigiK Member

    Joined:
    Jan 17, 2010
    Messages:
    188
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Pittsburgh, PA
    Ratings:
    +0
    In testing Compcache with backing swap, .18 Compcache + 64MB swap (30 swappiness) seems to be a good balance of caching vs responsiveness.

    By tweaking launcherpro down to about 13-14MB and setting VM Heap size at 32MB, I've managed to eliminate home screen redraws while keeping two browser windows, slacker radio, and google maps from being killed by the system. **I should add that my goal was to avoid locking the home app in memory, as that induces Android system to prematurely kill music & other high memory apps.

    Total swap utilization in this case hits a ceiling at about 65MB, or about 14MB for backing swap at these settings. This seems to imply backing swap is limited to <= cCache size, which is probably not a bad thing considering that increasing swappiness to 60 results in a grinding meltdown. 32MB would probably work just as well in light of this observation. I'll test that along with seeing how a swappiness of 40 works.

    All in all it seems like a guess and check operation since we're subjectively trading caching vs system responsiveness, but I'd be curious to hear Prime's experience with finding the most balanced settings.
     
    #46 DigiK, Mar 13, 2011
    Last edited: Mar 13, 2011
  11. prime

    prime Kernel Developer
    Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,934
    Likes Received:
    71
    Trophy Points:
    143
    Location:
    Florida
    Ratings:
    +74
    I haven't done any real testing with backing swap thus far, I partitioned a 4gb card with 3.3G/fat32 | 256M/ext4 | 64M/swap just last night and began moving apps to the ext4 partition with link2sd.

    I am uncertain if zram (current method) (not old ramzswap) even supports backing swap, I believe it must be linux managed but haven't had time to read up on the subject.

    I do know that zram swap and swap from an SD partition do function correctly when used simultaneously, personally I use a swappiness value of 18 with zram swap alone but prefer a swappiness of 28 when sd partition swap and zram swap both enabled.
     
  12. chmcclellan

    chmcclellan Member

    Joined:
    Jun 17, 2010
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Ratings:
    +0
    How do we go about adjusting the swappiness? I assume that's something we can do through the terminal?

    Also, Prime, any observation on the backing swap since you've had some time with it?
     
Search tags for this page
cm7 compcache
,
cm7 compcache ram usage
,
compcache android
,

compcache cm7

,
compcache ram cm7
,
compcache ram usage
,
compcache ram usage android
,

compcache ram usage cm7

,
dalvik.vm.heapsize
,
swap cm7