yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] mdavidf:
Could you create a signature we can see your setup?

If I understand you correctly then you should know that the Ext3 partition is also where your applications are stored. However, yes, some of us are discovering that 500MB may be slightly too much - for example, I have 320MB of free space on my Ext3 with 160 apps installed.

Hope this helps.
[G1 Android Development] MortICi:
EDIT: I don't think its busybox anymore....
[G1 Android Development] Karolis:
Just wondering what Cyanogen thinks of this. I saw he tweeted the link, so I guess it's rather safe to try :)
[G1 Android Development] avidplayer:
silly question, maybe but am I using the initial fat32 partition and the ext2/3 partition for app2sd plus an additional ext2/3 part for the swap or will it work on the same one as used for apps2sd?
[G1 Android Development] AustinKnight45:
@bkmo what was wrong with the other userinit file that was upped last night?
[G1 Android Development] Hakeem5:
my phone is lightning fast now, with apps2sd 8gb card, 500 ext2 partition and no swap, should i REALLY do this compache thing for a noticeable difference? and if i try other roms will anything be messed up?
[G1 Android Development] jubeh:
i guess what i was asking is, normally, in linux, the userinit.sh script is launched every boot, so i was wondering where android looked for that script to launch at every boot without having to manually run it. Either that or I"ll just append it to the start of some other script that's run at every time during boot, but i'd like to know which scripts are automatically run in android (or at least cm3671)
[G1 Android Development] glock30:
The script that launches userinit.sh is /system/bin/a2sd. The userinit.sh file needs to be located in /system/sd. When I first did this mod I just placed the compcache stuff at the end of the a2sd script and that also worked, but since it is on the SD card it won't get overwritten when doing a update.
[G1 Android Development] mdavidf:
If you push it to the /system/sd it will run every time you reboot your phone.
[G1 Android Development] bkmo:
Absolutely nothing. I was asked to maybe simplify it because of it being a compcache tutorial. The one I upped last night made nice linking of directories if you wanted to move the audio files from the fat32 partition to the ext. The latest update was tweaked a bit to lower swappiness to 60, but I think the original had 60 swappiness too.
[G1 Android Development] yosho:
A quick note for folks wanting to run this without an ext partition (no a2sd!)...

It looks like Cyan's a2sd script in /system/bin/a2sd will only run /system/sd/userinit.sh if there is an actual partition, so dropping the script in there will not work if no ext partition. If you want to get this working in the meantime, you can just append these lines to /system/bin/a2sd:

insmod /system/modules/lib/modules/2.6.29-cm/compcache/xvmalloc.ko;

insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko;

mknod /dev/ramzswap0 b 253 0;

echo 60 > /proc/sys/vm/swappiness;

swapon /dev/ramzswap0;

Please those right above the "sync;" line toward the bottom. Note that you will have to replace these lines on any reflashing, since /system gets overwritten.

Cyanogen: if you see this, can we maybe put in a similar userinit.sh for non-a2sd users somewhere? maybe include from the /sdcard/userinit.sh or /sdcard/initscripts.d/* locations?

To all involved with setting up the compcache stuff on android, HOLY CRAP AWESOME. Much thanks.
[G1 Android Development] uberingram:
I followed the OP to the letter and it looks like everything went good.

Phone does indeed seem to be a bit snappier.
[G1 Android Development] pgarza:
what version of cyons? i tried this with 3.6.7.1 and it was sluggish... im also using my original ext2 that my apps2sd is using... is that ok? im about to update to 3.6.7.2 to see if the memory leaks are from this compcache or from the rom.
[G1 Android Development] alapapa:
update to .2 -- he fixed a memory leak in the music app that caused me some slowness -- seems better now
[G1 Android Development] bkmo:
Compcache does not use ANY partitions or disk. It is a ram swap. The only thing that goes on the ext2 partition is the script to start it.
[G1 Android Development] fallinprince:
this seems an appropriate place to ask........ what is swap? what does it do?
[G1 Android Development] wddglr:
http://en.wikipedia.org/wiki/Swap_space
[G1 Android Development] fallinprince:
thanks you freakin rock
[G1 Android Development] asn1:
Can I do this to set up Comp Cache?

Can I do this to set up Compcache?

1. Shutdown phone (I am using Cyanogen 3.6.7.1)

2. Remove SD Card. Put it in Ubuntu and mount my ext3. Then copy the userinit.sh to the root of ext3.

3. Put the card back in and start the phone.

Will this set up compcache correctly?

Thanks in advance.
[G1 Android Development] hamshu:
Users of Compcache in the CynoMod Thread have reported lower battery life and extreme sluggishness when battery is low.
[G1 Android Development] jay22are:
ive been reading about that ....im considering of using my swap partition again
[G1 Android Development] sha.goyjo:
Please post the full story, if you are going to mention that thread. Some users have reported battery drain, but they all have class six devices. Those of us with class two devices do not. It's potentially an issue of the processor scaling (which is very efficient in CM) being forced to high speed by fast data decompression from the ramzswap process. It'll probably get worked out fairly soon, so don't worry about it too much. In the meantime, still way better for your expensive SD card then burning a hole through it with a swap space.

EDIT:

Just wanted to give a metric. My phone has been on for twelve hours and I'm only down to 50 percent battery life. I've definitely been using my phone too.
[G1 Android Development] nurre:
People who are having problems with battery drain, chances are you got background processes allocating and freeing memory constantly, and ending up taking things in and out of compcache. Which causes cpu scaling to go haywire.

A simple "fix" would be installing OverclockWidget and forcing a low frequency cpu speed max when the screen is off.
[G1 Android Development] ultra spikey:
If preserving the life of the sd card is the only advantage of using compcache, I don't really see the need to switch from a swap partition. From what I've read here, using a swap partition will take maybe 2 years to kill your sd card. Is there a difference in performance between compcache and a swap partition?
[G1 Android Development] DOHCtor:
compcache had way too many issues. I went back to linux swap
[G1 Android Development] MortICi:
It is always faster to compress and decompress (with the current speeds or ram and cpu's) from ram, than to write/read from block devices.

So compcache will be faster, ofcourse certain issues still need to be resolved.
[G1 Android Development] uberingram:
Pardon my complete ignorance but how would I go about turning compcache off?
[G1 Android Development] alapapa:
swapoff /dev/ramzswap0

to have it off at boot, comment out or remove the swapon & insmod lines from your userinit.sh
[G1 Android Development] uberingram:
It's giving "Invalid argument". :o
[G1 Android Development] MortICi:
Then you don't have it.

Whats the output of: cat /proc/ramzswap
[G1 Android Development] uberingram:
I'm getting GoodCompress if that's what you're getting at.
[G1 Android Development] MortICi:
Hmph, then i would just delete the userinit.sh script and reboot the phone, compcache is off,

swapoff /dev/ramzswap0

should turn it off, make sure your doing it as su.
[G1 Android Development] uberingram:
That's what I said too and yes I did it as su otherwise I'd be posting about permission errors. ;) Thanks for the insight. :)
[G1 Android Development] MortICi:
Well then i would comment out the line in userinit.sh that does swapon,

so:

blah blah

blah blah

# swapon /dev/ramzswap0

blah blah

put the # infront of it.

reboot.
[G1 Android Development] tricky76:
I installed the script according to the instructions in the OP and rebooted. I ran

cat /proc/ramzswap

And it appears the compcache is running.

However, when I type "free" the free space my linux-swap partition fluxuates. (I previosuly used the auto-swap userinit.sh and deleted it before copying the compcache userinit.sh) Is this fluxuation ok or do I need to take additional steps stop using the linux-swap? I am not using the swapper program.

I am using CM-3.6.7.2

thanks!
[G1 Android Development] short/y:
Would someone be so kind as to post the media-related lines that were removed from userinit.sh.txt that's in the first post? I'm seeing references to it here and in the cyanogen mod thread but have no real frame of reference for what they're referring to.
[G1 Android Development] bkmo:
if [ -d /system/media ] && [ ! -h /system/media ] && [ -e /system/sd/media ];
then
# fix the permissions
busybox chmod 777 /system/sd/media
for i in `ls -R /system/sd/media | grep ":" | sed "s/://"`;
do
cd $i;
busybox chmod 777 $i;
for j in `ls $i`;
do
busybox chmod 666 $j;
done
done

busybox mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
busybox rm -rf /system/media;
busybox ln -s /system/sd/media /system/media;
busybox mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
fi;
[G1 Android Development] bkmo:
If you used the attached userinit.sh then you are NOT running the disk based swap any nore. Free does not report the compcache swap correctly.
[G1 Android Development] short/y:
Thanks, bkmo, for the media info.
[G1 Android Development] TheMan42:
Quick question:

Is this stable enough and worth it to use and if I upgrade like I always do to another CM build, will the compcache settings transfer over?

I have 1GB EXT3, will this work correctly?
[G1 Android Development] nurre:
People who's feeling lag with this, try severely reducing the size.

If you were running 32mb, try 24mb or 16mb, hell even 8mb will give you some more memory to play with.

I'm guessing you have too many programs in the background, causing active programs to be paged in and out of swap.
[G1 Android Development] 2leaponover1:
Speed

Someone asked this but never got an answer. I just transferred to Cyanogens newest rom, and it is fast. The only time i ever get lag is going to my home screen, which is Ahome and has a sweet ass designed theme by someone which is why i imagine there is lag. Will this process really make cyanogen's rom faster, even though it is so fast to begin with? Is it worth messing around considering the battery woes some are experiencing. My batter life has always been ridiculous. It goes down 15% just going from my house to the car after taking it off the charger. I just pretty much plan on charging my phone wherever i go and not expecting my battery to be useful at any time.

Has anybody with no swapper program and cyanogen's newest rom, done this change and reccommended it based on the new speed, please respond.
[G1 Android Development] bmk789:
I saw one of these scripts on the forum and someone mentioned having backup swap in the compcache script. How is this done?
[G1 Android Development] <blank>:
From cyanogen w/ no apps2sd adding compcache via inserting into the apps2sd script, I'm getting a considerable amount of lag. I was using 32mb, but checking via cat /proc/ramzswap only showed 24mb decompressed and ~8mb compressed. The lag isn't really noticeable at first, but I left it on for a day of normal usage and things like going back to the home screen and starting some apps took significantly longer than usual.

This is speaking from personal preference as I am a big proponent of response time. The lag I experienced was mostly waking up from sleep state to take phone calls or respond to texts which I am a real stickler for response time in those situations. There may be slight speed increases in more memory intensive tasks such as extended browsing or running music and playing games, but that's not quite as important to me.

Overall, I feel like this would be a more beneficial thing for hero rom users as an alternative to swapper. I'm guessing the fact that the swap space still needs to be decompressed and transfered to RAM to be used is what's affecting the responsiveness, especially of the lighter memory apps.

That's just my experience from a day of light use though. YMMV.
[G1 Android Development] robpet2:
the script worked like a charm !!!
[G1 Android Development] dwang:
I would agree w this. If u use a backing swap, only 14megs are reserved for compcache. It makes things much more responsive, especially in conjunction w 3.6.5.
[G1 Android Development] <blank>:
but would that even be worth it? a couple of extra megs that you have to decompress and swap in and out constantly?
[G1 Android Development] dwang:
Seems faster than a straight swap partition. And its not giving me broswer refresh very often. So it is working.

When the compcache space fills up it goes out to the swap partition.
[G1 Android Development] pychobj2001:
Still using swap?

I did the userinit.sh copy to sd, and everything is working accourning to the 72 percent GoodCompress, but then I do the "free" command as well and it says it's using the swap also...so is it doubling up and still using my linux-swap? is that bad, if so how do I revert the userinit.sh I did previously, it should have gone away right? it was on the /system file, i've done upgrades since then...this post seem panicky...but i'm not..just confused about the "free" info I got...ha
[G1 Android Development] pychobj2001:
I am using the tunewiki app, and before it was give me a black screen when i was playing music and the pressed "back" to see the list of songs again...and it would give me the force close or wait, i haven't noticed that yet running campcache...I can open up steel wide, and run my tunewiki right after and still not have a oops..must kill then reload the "song list" from the memory...ha! luv's it! like the g1 was suppose to be...why couldn't they put stupid insane large ram in the g1? guess not every htc device can be my hero...but i'm not paying a grand for a phone..(ok, i'm ranting...I ban myself, ha)
[G1 Android Development] dixxa:
How is that possible since in the userinit script swapon point to /dev/ramzswap0; and no the third partition how can it goes to the swap partition.

I've tested compcache for 3 days and after some days it feel laggy.

maybe tools like swap replay or swap discard would be useful.

it could help in cleaning a bit the compcache.
[G1 Android Development] dixxa:
How is that possible since in the userinit script swapon point to /dev/ramzswap0; and no the third partition how can it goes to the swap partition.

I've tested compcache for 3 days and after some days it feel laggy.

maybe tools like swap replay or swap discard would be useful.

it could help in cleaning a bit the compcache.

Edit:

i'm trying a small modified userinit.Sh

this what I got in it

insmod /system/modules/lib/modules/2.6.29-cm/compcache/xvmalloc.ko;

insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko disksize_kb=32000 backing_swap=/dev/block/mmcblk0p3;

mknod /dev/ramzswap0 b 253 0;

echo 20 > /proc/sys/vm/swappiness;

swapon /dev/ramzswap0;

exit;

anybody willing to try this out.

It seems really responsive to me.
[G1 Android Development] innerspace:
Giving it a shot now

@dixxa

Because I'd like to have my swap file available as a backing swap. I notice my phone getting laggy as its been on for a long time. Reboot brings it back to its snappy self. I did not see this behavior when only using a linux-swap.

I asked the following question in the other active thread on compcache;

How do we test to see whether the backing swap partition is indeed active and doing its job? And how do we see how much/often it is being utilized?
[G1 Android Development] dixxa:
hummm

reboot is really too long

why not just :

su

swapoff /dev/ramzswap0

and then

swapon /dev/ramzswap0

I'm trying to find the fastest solution.

Linux Swap-partition vs compcache.

I don't mind using my sdcard.

shorten the lifetime of the sdcard of 1 or 2 years is nothing since in few weeks 16Gb will cost about the same price as 8Gb.

From what I've read everywhere. swap-partitions remains the fastest alternative.
[G1 Android Development] overpower:
Invalid parameters

@dixxa

Just a head sup, the parameters you have for ramzswap.ko are incorrect.

According to http://code.google.com/p/compcache/wiki/CompilingAndUsing:

There are two states for ramzswap. The first is when you have a backing swap.

insmod ramzswap.ko memlimit_kb=32000 backing_swap=/dev/block/mmcblk0p3

The second is when you run ramzswap without a backing swap.

insmod ramzswap.ko disksize_kb=32000

As written, I believe ramzswap is defaulting to the second case where it isn't using a backing swap.

Please note there are two ways to have a backing swap. The first is the syntax above. In that case, 'free' and 'cat /proc/swaps' will not be able to report anything as compcache is handling everything internally.

As of this moment, I haven't figured out whether '/cat/proc/ramzswap' will provide info as it appears cyanogen only included compcache .5, and I only have a file swap. Anyone know?

The second is to let linux handle it, and involves an additional

swapon /dev/block/mmcblk0p3

This second swapon should happen after the enable for ramzswap so that it has lower priority and is used only if ramzswap is full.

The main difference between the two methods, according to the docs, is that allowing ramzswap to handle it internally gives ramzswap control to move stale memory from ramzswap to the backing swap at its discretion. This may lead to improved performance over the linux version. However, I'm not sure if this pans out.

*As a note, if you want to understand what each parameter does, there's an old post here. The names parameter names have changed, but it should give you an idea of what each is supposed to do.
[G1 Android Development] dixxa:
why is the parameter incorrect ??

Usage:

Loading: run 'use_ramzswap.sh [disksize(KB)|memlimit(KB)] [backing swap device]' to load all required modules and setup swap device.

you can have multiple parameters and those are good. I think...
[G1 Android Development] fh47qu:
This works great. Easy too install. Thank u very much for the helpful directions
[G1 Android Development] overpower:
Notice there is a '|' between the two parameters. That means 'or'. They are exclusive parameters. Either use disksize or memlimit. Of course, its not clear without reading the examples or source code which one to use when enabling the backing_swap. If you play around with them you will notice only memlimit seems to work with backing_swap.

Also, you're not using the script (use_ramzswap.sh) to load but manually loading the module (insmod).
[G1 Android Development] ioshen:
Everything went great! Thanks 4 ur time and all the hard work.

I'm running 100, should I go to 60 or just leave it there?
[G1 Android Development] h.nocturna:
Hi guys, I'm trying to get this working on jacHEROski, so I was wondering if someone can post the modules required to get this working.

Btw, can I just push the modules to the directory and get it to work?

Thanks guys.
[G1 Android Development] Noslice2002:
i have tried this everyway I can, but each time i get the cannot stat userinit.sh, no such file or directory message. it's driving me nuts. I can usually figure this stuff out by reading, but can't this time. Any suggestions?
[G1 Android Development] h.nocturna:
Just means you're not typing in the location correctly and they can't find the file there. try re-typing/checking your location and making sure the file is there. Also, caps do matter.
[G1 Android Development] yomamaster:
Audio Files

Can someone re-post the old userinit.sh or directions for moving the audio files so that the music application doesn't see them all?

I know there's a post elsewhere to describe how to do this, but I can't find it for the life of me.
[G1 Android Development] innerspace:
2nd result

http://xdaforums.com/search_rop.php?searchid=25962525
[G1 Android Development] h.nocturna:
Where do lzo_decompress/compress.ko go?

Tried pushing xvmalloc.ko and ramzswap.ko to /system/modules/lib/2.6.29-cm/compcache/

now when I run the script it get:

insmod: init_module '/blah/xvmalloc.ko ' failed (Exec format error)

I get this error for ramzswap.ko as well. Any Ideas? thanks
[G1 Android Development] stellarman:
My "goodcompress" reading has shown as 100% every time I have checked it in the past couple of days. Could that be right?? Everyone else is reporting 65 - 75%. All the other numbers seem to make sense. Any ideas?

<edit> BTW, I am using the userinit.sh script that sets up default size and backing_swap on my linux-swap partition, and swappiness = 20.</edit>
[G1 Android Development] yomamaster:
Man...

I thought I read through this whole thread looking for that. Guess I need new glasses...

Looking at the script though, it doesn't move anything from /sdcard into /system/sd...doesn't that mean you lose all of the ringtones from cyanogen's audio resources file?
[G1 Android Development] Ohsaka:
I decided to nuke my phone tonight.

Repartitioned card, formatted, wiped, etc etc.

Lol, now check out what the internal memory widget reports for me in the screenshot below....

Only 3mb used up out of 74mb!

I used this line in my userinit.sh and 20 swappiness:

insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko memlimit_kb=15360 backing_swap=/dev/block/mmcblk0p3

Here is what 'free' and 'cat /proc/ramzswap' report:

# free
free
total used free shared buffers
Mem: 97876 95468 2408 0 3348
Swap: 24464 1656 22808
Total: 122340 97124 25216
# cat /proc/ramzswap
cat /proc/ramzswap
DiskSize: 24468 kB
NumReads: 248
NumWrites: 417
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 39
GoodCompress: 80 %
NoCompress: 3 %
PagesStored: 378
PagesUsed: 105
OrigDataSize: 1512 kB
ComprDataSize: 410 kB
MemUsedTotal: 420 kB
[G1 Android Development] bpcrew:
Hallo,

can someone please compile the compcache module 4 the kernel build in the JF 1.51 FW

MfG bpcrew
[G1 Android Development] overpower:
@innerspace

Found the answer here.

In short, cat/proc/ramzswap will reference the backing_swap if it's there:

With backing 'cat /proc/ramzswap'

BackingSwap: /home/ngupta/temp/swap.dd
DiskSize: 1048576 kB
MemLimit: 586524 kB
NumReads: 2
NumWrites: 0
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 0
GoodCompress: 0 %
NoCompress: 0 %
PagesStored: 0
PagesUsed: 0
OrigDataSize: 0 kB
ComprDataSize: 0 kB
MemUsedTotal: 0 kB
BDevNumReads: 18
BDevNumWrites: 0

Without backing 'cat /proc/ramzswap':

DiskSize: 977540 kB
NumReads: 112
NumWrites: 0
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 0
GoodCompress: 0 %
NoCompress: 0 %
PagesStored: 0
PagesUsed: 0
OrigDataSize: 0 kB
ComprDataSize: 0 kB
MemUsedTotal: 0 kB
[G1 Android Development] Booker-T:
What is the different between userinit.sh and Swapper?
[G1 Android Development] jasherai:
diff between swapper and userinit.sh scripts

Hi Booker-T,

Swapper is an application that creates a swap file on your sd card (location configurable), and notifies the system that there is more memory space available. Swapper is also able to use a swap partition if there is one available.

The userinit.sh script is a script that can be used by users to make and changes they want at boot time. In this instance, you are talking about using this script to run the commands that will enable a swap partition.

The advantage of userinit.sh over the swapper app is that the userinit /should/ run earlier in the boot up sequence. And also you do not have to have an app installed to enable it. The downside, is the lack of easy UI for you to make changes. You should know what you are doing before editing one.

There are obviously a number of these out there... make sure you read the comments in the file so you know what the script is doing.

G'luck!

jasherai :cool: