+ Reply to Thread
Page 1 of 6 123 ... LastLast
Results 1 to 10 of 60

Thread: CompCache - userinit

  1. #1
    Join Date
    Nov 2008
    Location
    Greensboro, NC
    Posts
    219

    Default CompCache - userinit


    [EDIT] I posted this a while back -- I am not sure how all this works with newer versions [\EDIT]

    Creating this as a separate thread to discuss all things compcache/swap.

    EDIT: This might only work with Cyan's ROM's -- I don't really know you are welcome to try with other ROM's though -- and if ya do -- let us know how it goes!

    I'm just going to start by detailing how I got setup with compcache with backing swap. (the second post will tell why you want to use backing-swap instead of linux swap)

    EDIT: Though you may decide you don't want to use either, and just want vanilla compcache -- if that is the case -- and you don't already have compcache setup you can still follow the instructions below, and just ignore the parts that tell you, you have to have a linux swap partition, and that you should edit the files)
    (also -- regardless of how you set it up -- once you have compcache setup - you can use the intructions in post three -- to try tweaking settings like swapiness, if you are so inclined)


    (Also -- see the third post for instructions on what to do if you are already set up, and just want to tweek some values)

    To save time -- I am going to steal from previous posts. (many thanks to SilleeString, as I stole much from his posts )

    If anyone has suggestions for updates/corrections/clarifications -- feel free to PM me and I will do my best to include them -- Though I am going to be a bit busy this weekend


    Here we go....

    So to get setup with backing swap first you need to have a swap partition on your SD card. If you are sure you already have a linux-swap partition on sdcard (in addition to ext3 partition) -- or if you just want compcache with no backing_swap -- skip this paragraph
    I have cooked up a method to repartition your SD card and not loose anything -- I have made a separate post detailing the method -- it can be found here (this will backup and restore your ext3 partition/apps too!)
    http://androidcommunity.com/forums/232988-post31.html


    OK -- so at this point you should have a linux-swap partition, on your SD card (unless you are just trying to setup compcache without backingswap or linuxswap)


    First - Download the newest version of userinit.sh found here
    http://forum.xda-developers.com/showthread.php?t=542899

    Unzip the files on your sdcard and edit "user.conf" looking for and editing the following 3 variable assignments


    NOTE: if you edit user.conf you must use a linux friendly editor(i.e. notepad/wordpad are not linux freindly) -- if you dont have one -- see below for a work around -- and for now -- just use wordpad to open, and edit the files.
    Here is how to use wordpad to open and edit the files
    Open wordpad from the start menu under Accesories
    then File --> Open
    In the open file dialog browse to the folder with the files
    Then near the bottom of the open file dialog box -- find the "Files of Type" dropdown box -- select "All Documents (*.*)" and you should be able to see the files now
    Open the files, edit them as instructed below, and click save



    Variables to look for and set/edit.... (assuming you are trying to setup backing_swap)
    Code:
    cc_backingswap_en=1
    cc_disksize=0
    cc_memlimit=8
    and make sure (linux_swap_en=0)

    (The above variable set, is to setup compcache with backing_swap -- See the bottom of post 3, for more different sets of variables you can try for different configs)




    then type the following into terminal:
    Code:
    su
     mount -o remount,rw /dev/block/mtdblock3 /system
    WORKAROUND: If you did not use a linux friendly editor to user.conf, (i.e. notepad/wordpad are not linux freindly) you must run the following command at this point....
    Code:
    dos2unix /sdcard/user.conf
    This converts user.conf to linux format from the format notepad/wordpad saves them in in windows.




    Now we need to copy the files from the sdcard to where they need to go. So do the following in terminal
    Code:
    cp /sdcard/userinit.sh /system/sd
    cp /sdcard/user.conf /system/sd
    IF THIS IS THE VERY FIRST TIME YOU EVER SETUP COMPCACHE -- THEN SKIP THIS PARAGRAPH

    If you already had compcache enabled -- and are just trying to add backing swap -- then all you need to do is reboot your phone now, and run the following to verify (you should see something about "backingswap" near the top)
    Code:
    rzscontrol /dev/block/ramzswap0 -s
    The rest of the instructions below, only need to be done, if you are setting up compcache for the first time





    START BACK HERE IF YOU HAVE NEVER SETUP COMPCACHE BEFORE
    Here's how to enable it:
    Code:
    modprobe ramzswap
    rzscontrol /dev/block/ramzswap0 --init
    swapon /dev/block/ramzswap0
    Might be good to reboot the phone here.


    To get stats:
    Code:
    rzscontrol /dev/block/ramzswap0 -s
    Last edited by bdb4269; 11-29-2009 at 03:43 PM. Reason: update to link to my post about how to repartition without losing your stuff :)

  2. #2
    Join Date
    Nov 2008
    Location
    Greensboro, NC
    Posts
    219

    Default Re: CompCache - userinit

    Here is why I suggest backingswap instead of Linuxswap for use with compcache.

    Quote Originally Posted by bdb4269 View Post
    OK -- so I did some reading onthe userinit/compcache thread on xda.

    Looks like I did not have linux swap enabled, AND, looks like it is actually better to use backingswap with compcache instead of linuxswap anyway, because compcache can control backingswap so that it initegrates better.
    Quote Originally Posted by huanyu@xda
    compache = ram based swap (much faster when compare to disk/flash based swap)
    back_swap = ram based swap + normal swap based on disk/flash and managed by compcache
    linux swap= disk/flash based swap managed by Linux
    http://forum.xda-developers.com/show...&postcount=169


    Anyway -- so I now have compcache enabled with backing swap, using my swap partition on SD card. And it now shows the entire size of the swap partition. Plus 100% GoodCompress.

    Check out the screen shot (output from rzscontrol /dev/block/ramzswap0 -s and free)
    http://androidcommunity.com/forums/a...9&d=1249497020
    and
    output below from the status command mentioned on the compcache thread. (sh /system/sd/userinit.sh -s)

    Code:
    $su
    # ash
    / # sh /system/sd/userinit.sh -s
    ===CompCache status===
    CompCache version 0.6+
    Compcache enabled
    CompCache: MemLimit 8192(system) 8192(user)
    CompCache: BackingSwap /dev/block/mmcblk0p3(system) /dev/block/mmcblk0p3(user)
    CompCache: cc_swappiness - 30(system) 30(user)
    === CompCache status ===
    BackingSwap:    /dev/block/mmcblk0p3
    DiskSize:         610470 kB
    MemLimit:           8192 kB
    NumReads:            396
    NumWrites:          1378
    FailedReads:           0
    FailedWrites:          0
    InvalidIO:             0
    PagesDiscard:          0
    ZeroPages:            73
    GoodCompress:        100 %
    NoCompress:            0 %
    PagesStored:         822
    PagesUsed:           184
    OrigDataSize:       3288 kB
    ComprDataSize:       726 kB
    MemUsedTotal:        736 kB
    BDevNumReads:         68
    BDevNumWrites:       483
     ===VM status===
    Set VM: page-cluster - 3(system) 3(user)
    Set VM: laptop_mode - 0(system) 0(user)
    Set VM: dirty_expire_centisecs - 3000(system) 3000(user)
    Set VM: dirty_writeback_centisecs - 500(system) 500(user)
    Set VM: dirty_background_ratio - 5(system) 5(user)
    Set VM: dirty_ratio - 10(system) 10(user)
    ===CPU status===
    Set CPU: scaling_min_freq - 528000(system) 528000(user)
    Set CPU: scaling_max_freq - 528000(system) 528000(user)
    Set CPU: sampling_rate - 2000000(system) 2000000(user)
    Set CPU: powersave_bias - 200(system) 200(user)
    / #
    Last edited by bdb4269; 08-06-2009 at 11:44 AM.

  3. #3
    Join Date
    Nov 2008
    Location
    Greensboro, NC
    Posts
    219

    Default Re: CompCache - userinit

    Then -- if you want to tweak values -- all you need to do is edit the user.conf file on your SD card, and then do the following and reboot
    Code:
    su
    mount -o remount,rw /dev/block/mtdblock3 /system
    WORKAROUND: if you did not use a linux friendly editor to edit user.conf, (i.e. notepad/wordpad are not linux freindly) you must run the following command at this point....
    Code:
    dos2unix /sdcard/user.conf
    This converts user.conf to linux format from the format notepad/wordpad saves them in in windows.

    Then just
    Code:
    cp /sdcard/user.conf /system/sd
    And then reboot your phone.



    And here are some lists of values you can use, if you want to try different configs. Remember to use linuxswap or backingswap you must have a linux swap partition. If you don't see post 31 if you want to set one up.

    NOTE: For all the variable sets below -- you want to look for the variable in "user.conf" and edit the value to match the value shown below. Then follow the steps above, to put the user.conf file into place.

    To use only linux-swap
    compcache=0
    cc_backingswap_en=0
    linux_swap_en=1
    To use only compcache without backing_swap
    compcache=1
    cc_backingswap_en=0
    linux_swap_en=0
    cc_disksize=32
    cc_memlimit=0
    To use compcache with backing_swap
    compcache=1
    cc_backingswap_en=1
    linux_swap_en=0
    cc_disksize=0
    cc_memlimit=8
    To use compcache with linux swap
    compcache=1
    cc_backingswap_en=0
    cc_disksize=32
    cc_memlimit=0
    linux_swap_en=1
    originally posted by uwonsum
    p.s. you can can also play with the different swappiness settings to tweak and play around.
    Last edited by bdb4269; 08-12-2009 at 01:41 AM.

  4. #4
    Join Date
    Oct 2008
    Location
    p and ocean ave , brooklyn
    Posts
    7,835

    Default Re: CompCache - userinit

    nice ! thanks bdb4269 for starting this thread . im sure it will help a lot of people

    To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.

  5. #5
    Join Date
    Jun 2009
    Posts
    65

    Default Re: CompCache - userinit

    Thanks bdb... this surely helped me when it was in bits and pieces in another thread. It will be nice to be able to reference all of this in one thread!

  6. #6
    Join Date
    Nov 2008
    Location
    Kissimmee, Fl
    Posts
    763

    Default Re: CompCache - userinit

    I was reading this over at xda yesterday and I was wondering why backing swap was better to use with compcache over linux swap. 100% good compress?? man compcache and backing swap were meant for each other lol. gonna go change this now...

    EDIT: enabled backingswap, running at 100% Good compress
    Last edited by jroid; 08-06-2009 at 12:55 PM.
    ALL White G1
    Cupcake
    Cyan 3.6.3
    Hero Theme 1.4.5
    apps 2 SD | 85 Mb free

  7. #7
    Join Date
    Oct 2008
    Location
    Brooklyn
    Posts
    316

    Default Re: CompCache - userinit

    GREAT thread. Thanks for putting it together, bdb.

    Double thanks for the 3rd post. Gotta do that to enable backing swap! Good stuff.
    Last edited by SilleeString; 08-06-2009 at 12:52 PM.
    - Cyanogen Mod du jour
    - Compcache
    - Recovery Image 1.4
    - Apps on SD
    - Caches to SD

  8. #8
    Join Date
    Jul 2009
    Posts
    301

    Default Re: CompCache - userinit

    i have comcache enabled but what does backing swap do anyone?
    and also can someone upload there userinit file so that i can upload it i am not more of a linux user so i don't know how to make those changes to have a good compress of 100%
    Android G1
    Rom: Cyanogen 6 DS
    Recovery:New Amon Ras' 1.7.0
    Spl: Danger Spl
    Radio: 2.22.23.02
    App2Sd:|7.5Gig fat32/500M ext4|

    To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.

  9. #9
    Join Date
    Jul 2009
    Posts
    301

    Default Re: CompCache - userinit

    Ok so basically i don't know what does backswapping do? and can't edit the userinit file cuz i have no idea how to edit a file like that i haven't done it before
    Android G1
    Rom: Cyanogen 6 DS
    Recovery:New Amon Ras' 1.7.0
    Spl: Danger Spl
    Radio: 2.22.23.02
    App2Sd:|7.5Gig fat32/500M ext4|

    To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts.

  10. #10
    Join Date
    Nov 2008
    Location
    Greensboro, NC
    Posts
    219

    Default Re: CompCache - userinit


    Quote Originally Posted by muhammadsauud View Post
    i have comcache enabled but what does backing swap do anyone?
    and also can someone upload there userinit file so that i can upload it i am not more of a linux user so i don't know how to make those changes to have a good compress of 100%
    Try my howto in post 1. Even if you are just on windows, you can edit the files with wordpad. My post includes an extra step so that you can use wordpad to edit the files.

    If anything is unclear -- just let me know and I will try to clarify.
    (plus, then I can updated the OP to be more clear for other people coming to this thread)


    p.s. the reason I don't want to just post my files, is that when a new version is posted to xda, I would have to post new files here -- better for you to learn how to do it on your own we can help

    give a man a fish - you feed him for a day
    teach a man to fish - you feed him for a lifetime

+ Reply to Thread
Page 1 of 6 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts