yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] simplyTravis:
Ok, I renamed my userinit.sh file back to a .txt file to get rid of compache but that did not work. Anyone have a better method to turn it off? (also, I did reboot my phone after changing the file)

Cyanogen's last two builds have caused my phone to not receive calls correctly (where it goes black for 2 rings without being able to answer) and when that is combined with compache slowing things down I can't use it as a phone.

I may be completely ignorant of how compache works but would it help to change the 24mb default to a higher number?
[G1 Android Development] jasherai:
@simplyTravis

I'm not sure of the calls issue, but can you confirm that the file you renamed was at the /system/sd/userinit.sh location? if you are renaming from /sdcard/userinit.sh, that is not the file being executed.

In order to manually disable compcache do the following in a terminal

$ su
# cat /proc/swaps
# swapoff /dev/ramzswap0
# cat /proc/swaps

The above will only disable compcache for the current session, and won't stick on a reboot, so you will have look into that.

With regards to google voice taking up lots of ram, you might benefit from LOWERING the compcache size to 16M or 8M (some people have had better results from this).

Remember compcache works by reserving some ram space for swap space, the benefit lies in the compression that is done, and the greater speed of this over a normal swap partition (on sd card), so a smaller compcache will still allow other processes to swap out of ram and retain more "real" ram for the application.

I hope this makes sense!

jasherai
[G1 Android Development] jasherai:
hmmm interesting. A 32mb swap suggests it is enabling a swap partition rather than the compcache.

Could you give us the output of the following commands:

# cat /proc/swaps
# cat /proc/ramzswap
# lsmod | grep ramzswap

Also a copy of your /system/sd/userinit.sh would be useful too... (just to be sure!)

jasherai
[G1 Android Development] overpower:
Oh I wasn't being very precise. I'm not saying that it will definitely force close, but what happens when you disable swapspace is that the kernel will:

Try to relocate any swapped memory into physical memory.

Fill up physical memory.

Use either Android's lowmemorykiller or linux's oomkiller to free memory by choosing a process to kill. If the system is really busy due to all the i/o, the kill may not happen fast enough, and then you'd see either a force close/wait dialog, or a plain force close as the system decides its time to move on.

This is probably going to be a cgroups issue, which at this point only cyanogen seems to be pursuing. The basic linux kernel doesn't have a way to lock a process in physical memory, so the next best thing is to force the priority of any processes that do need to be in physical memory to have a guaranteed minimum quota of memory (hopefully preventing swapping).

I'm wondering if after we've managed to ensure critical components aren't being swapped out via cgroups whether we can disable android's low memory killer or modify it to take into account total available memory. The low memory killer aggressively protecting physical memory is a kludge that doesn't make much sense if you have virtual memory.
[G1 Android Development] martinx817x:
when i type in

# cat /proc/swaps = i tells me that my swap is 32mb

# cat /proc/ramzswap = tells me there is no such file or directory

# lsmod = type this in and just goes to the next #
[G1 Android Development] jasherai:
ok.. the lack of output from lsmod suggests that either compcache hasn't been enabled correctly or the modules don't exist on your device.

Can you give me the output of the following pls?

# ls -l /system/modules/lib/modules/2.6.29-cm/compcache/
# ls -l /system/sd/userinit.d/etc/

thanks,

jasherai
[G1 Android Development] martinx817x:
typed in the first one = says no such file or directory

typed in second one = has -rw-rw-rw a date then use_compache

-rw-rw-rw then date use_compache_backing

-rw-rw-rw then date use_swap

if you don't mind could you post your sh script for me? I got mine from someone else on the forum
[G1 Android Development] VGPOP:
I've followed this and when I attempt to do this command:

adb push c:\userinit\userinit.sh /system/sd

It says

cannot stat 'c:\userinit\userinit.sh' : No such file or directory

I have adb running, I created folder, I put file inside folder. (I didn't have to rename it, it was already renamed userinit.sh)

So, what's wrong?

Also:

I even tried using terminal commands.

I put file in my SD card.

After typing this (terminal)

# cp /sdcard/userinit.sh /system/sd

I got

cp: cannot stat '/sdcard/userinit.sh': No such file or directory.

Anyone can help me?
[G1 Android Development] simplyTravis:
How would I lower it? Do you know the terminal commands or would I change up the script and re-push it. I don't have ADB so I can't really use that. Also, would I have to re-push it every time I start my phone up?

THANKS A TON JASHERAI! I'm an androidcommunity user originally but now that I'm getting in to some of this more in-depth stuff I am using less of that forum. Apparently I've been calling it compache for a while also...sounded like a Native American Linux tribe that way lol.
[G1 Android Development] cyanogen:
I built compcache 0.6 from hg and it doesn't work at all..

<6>[ 999.533630] ramzswap: NUM_DEVICES not specified. Using default: 1
<6>[ 999.540588] ramzswap: Creating 1 devices ...
<6>[ 1222.411437] ramzswap: disk size not provided. You can use disksize_kb module param to specify size.
<6>[ 1222.411468] Using default: (25% of RAM).
<6>[ 1222.427246] ramzswap: disk size set to 24468 kB
<6>[ 1272.504028] Adding 24464k swap on /dev/block/ramzswap0. Priority:-1 extents:1 across:24464k SSD

# rzscontrol /dev/block/ramzswap0 --stats
DiskSize:	37624 kB
NumReads:	171
NumWrites:	113
FailedReads:	0
FailedWrites:	391
InvalidIO:	0
PagesDiscard:	0
ZeroPages:	0
GoodCompress:	0 %
NoCompress:	0 %
PagesStored:	0
PagesUsed:	0
OrigDataSize:	0 kB
ComprDataSize:	0 kB
MemUsedTotal:	9 kB

Will post to the issue tracker..
[G1 Android Development] stopjockingme@gmail.com:
Same problem here.
[G1 Android Development] h.nocturna:
Maybe you have hide file extensions on so that it looks like its named userinit.sh but its actually named something like userinit.sh.txt
[G1 Android Development] VGPOP:
Bingo!

I am using Windows XP, so I went

My Computer

Tools

Folder Options

View

Checked Hidden Files and Folders

Unchecked Hide Extensions for known file types (this one did the trick)

The little sucker .txt appeared at the end of file and I renamed it to userinit.sh.

It asked me if I wanted to do change, and I click OK.

Let's see if this works now. IT SHOULD! :mad:
[G1 Android Development] stopjockingme@gmail.com:
Your right, thank you!

This is what I did to fix this..

ON VISTA

1. Click start menu, Click My Computer, once the window opens up, push ALT on your keyboard. Then go to the Tools tab at the top of the window then go to Folders option. Click VIEW, scroll down til you see "Hide extensions for known file types" and uncheck it.

Then just rename the userinit.sh.txt to userinit.sh

THATS ALL FOLKS, MEEP MEEP.
[G1 Android Development] h.nocturna:
No need to thank me citizen, I'm just doing my job. *puts arms on hips and looks sideways to the sky*
[G1 Android Development] simplyTravis:
Ok, I did something amazingly stupid and softbricked my G1. I would suggest before messing around with the compcache code that you do a nandroid backup to a stable build that did not have compcache enabled. This just saved my arse!
[G1 Android Development] pinetreehater:
Mine did the same thing when I tried to use Dixxa's method to check (/system/sd/userinit.sh status).

But when I use BKMO's (the OP) method (cat /proc/ramzswap) I got the results I was looking for.

Also, when I tried to use DIXXA's userinit.sh file with the directions that BKMO posted, I got errors. Not sure, but I think if you use DIXXA's file you need to use his directions. And if you use BKMO's userinit.sh file you need to use his directions.

I may be wrong, but it would not work for me until I used the OP's file with his directions. I had wanted to use DIXXA's userinit.sh (since it seems more advanced), but could never get it working.
[G1 Android Development] nephron:
great tut. Works great! Thanks a lot :D
[G1 Android Development] Hakeem5:
Ramzswap not found?

Hey i followed all directions to get compache running on my device, i went into the terminal on the phone and entered the command cat /proc/ramzswap and it says : not found. Any idea?
[G1 Android Development] simplyTravis:
Compcache FAQd

Ok, I think this should go in a possible compcache faq. I did not include the actual installation instructions because they are on the first page. Maybe this could be a supplement to that.

1. What should I do before I start?

A. Make sure to do a nandroid backup with a working non-compcache enabled rom.

2. How do I get rid of compcache?

A. There are a few methods. You can use root explorer (from market about 2 bucks) and delete userinit.sh by going to the system file, then the sd file. In other words /system/sd/userinit.sh

A-b. You can go through ADB with this(thanks njuncos):

adb remount
adb shell rm /system/sd/userinit.sh
adb reboot

A-b-c. You can type this in to the terminal (thanks painrage)

mount /system/sd
rm /system/sd/userinit.sh

3. What happens if I'm a complete, blithering idiot and load up the wrong userinit.sh file?(Like maybe I took a txt document with a grocery list on it and renamed it to an .sh file)

A. Well, re-flash with nandroid to a stable ROM and then remove the userinit.sh to disable compache. (see above)

4. I find that my phone is still running a bit sluggish, how can I fix that?

A. Sometimes you can run in to a problem with the compcache being slower than your phones RAM. In that instance try changing the compcache size from 24000kb to 16000kb or 8000kb.

First you need to disable compcache. Then open up a userinit.sh file through txt. Simply renaming your old file to userinit.sh.txt on your computer should work.

You will need to change the line that has disksize_kb=32000; to disksize_kb=16000; or another number if you like.

Original File

#!/system/bin/sh

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=24000;
mknod /dev/ramzswap0 b 253 0;
echo 60 > /proc/sys/vm/swappiness;
swapon /dev/ramzswap0;

exit;

Altered file with 16mb partition (feel free to copy and paste in to a text document and then rename it userinit.sh)

#!/system/bin/sh

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=16000;
mknod /dev/ramzswap0 b 253 0;
echo 60 > /proc/sys/vm/swappiness;
swapon /dev/ramzswap0;

exit;

After you finish altering your code make sure to put it on the main directory on your sd card. Follow the tutorial on the first page of this thread to install it.

Thanks to all those who have helped me on my first real day on xda! My phone is blazing fast again! And yes, I was a complete, blithering idiot while making this.
[G1 Android Development] dixxa:
Yeah And I use cyanogen based build so I have compcache included I can see in the signatures that many people don't use build with direct modules compiled in it .

But the userinit.sh file clearly point to CM-2.6.29/modules.

This is a mini how to for people who want compcache :

for those with non-cyanogen builds

go get compache here : http://xdaforums.com/showpost.php?p=4171481&postcount=188 and uncompress it .

just get this View attachment userinit.sh.txt rename it to userinit.sh and put it in the compcache directory below

Then, let's assume you have ADB and you know how to run it, push the files you've downloaded previously.

adb remount

adb push xvmalloc.ko /system/sd

adb push ramzswap.ko /system/sd

adb push userinit.sh /system/sd

adb shell chmod 755 /system/sd/xvmalloc.ko

adb shell chmod 755 /system/sd/ramzswap.ko

adb shell chmod 755 /system/sd/userinit.sh

adb shell reboot.

userinit.sh content :

#!/system/bin/sh

insmod /system/sd/xvmalloc.ko;

insmod /system/sd/ramzswap.ko memlimit_kb=16000;

mknod /dev/ramzswap0 b 253 0;

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

swapon /dev/ramzswap0;

exit;

Feel free to correct me if I'm wrong.
[G1 Android Development] jasherai:
Hi again, (Sorry needed a sleep break!)

It looks like you are not using a cyanogen >3.6.7 build. The compcache modules were only part of that build and greater. Can you let me know which rom you are using? As the compcache modules are compiled against the kernel, it would be good to know which versions of the module files you need.

jasherai
[G1 Android Development] h.nocturna:
Do you think you can compile it for JACHero2.7.3? Pretty please? :D
[G1 Android Development] jasherai:
At the moment you would need to edit the file (there is a variable at the top of the script called compcache_size) and the push it back. My next version of the script will allow you to set those values in files.

You don't need to repush the file every boot, only when you make changes to the script itself. FYI: if your ext partition is mounted on /system/sd/ then it should survive rom flashes too. :)

Let me know how you get on with this! :cool:

jasherai
[G1 Android Development] jasherai:
@cyanogen Bah! I was gonna try and get my script friendly for both versions before you brought this out...

Could you send a copy of the new modules and the control script so I can clean up my script for the new syntax?

Thanks!

jasherai
[G1 Android Development] jasherai:
@h.nocturna

Zarboz has already done some great work on compiling the modules for JACHero2.7.3, [http://xdaforums.com/showthread.php?t=539173]

My script should work fine there as it uses uname to find the correct kernel version and path. (Let me know if you have any issues!)

As an FYI: JACHero 2.7.4 appears to have the modules already part of the base install, but not enabled by default (this is where the various userinit.sh script come in)

Hope this helps!

jasherai
[G1 Android Development] jasherai:
@dixxa

Hey, just for clarity, if you were referring to my script, it actually uses uname -r to compile the correct path of the kernel from each system.

Great instructions btw! jasherai
[G1 Android Development] h.nocturna:
I know, I helped him out with it, I'm actually mentioned on the OP :D, but if you could compile it for the haykuro module, we can get multi-touch to work too. :D But whatevs, I can wait till they compile it for JACHero2.7.5(?)
[G1 Android Development] dixxa:
ow ok I didn't know.
[G1 Android Development] overpower:
ANR (Application Not Responding) crashing when compcache full?

Wondering if anyone else is noticing ANR dumps when the ramzswap0 gets full.

In logcat you'll see stuff like:

07-22 03:43:20.936: INFO/ActivityManager(164): ANR (application not responding) in process: com.twofortyfouram.locale
07-22 03:43:20.936: INFO/ActivityManager(164): Annotation: Executing service ComponentInfo{edu.mit.locale/edu.mit.locale.service.LocaleService}
...
07-22 03:43:21.636: INFO/dalvikvm(15592): Wrote stack trace to '/data/anr/traces.txt'

The GUI will likely freeze at this point and you'll see a force close dialogue, normally with the process which had the ANR. Of course the GUI isn't responsive at that point as the i/o dumping to /data/anr/traces.txt is blocking the phone.

I have a linux-managed backing, so I do have more swapspace so it isn't a total out-of-swap space issue. I'm thinking there may be a bug with compcache as it fills up. Of course, it may be related to a out-of-memory issue since Android is aggressive on that regardless of swap.

The ANR is especially bad if a call comes in as the amount of time it takes to clear out of the ANR will mean you've missed the call. This may be what a lot of people are seeing when they miss the call but don't see the incoming call dialog nor ringtone.
[G1 Android Development] innerspace:
brilliant!

Thank you VERY much for this excellent contribution, works like a charm!

I'll be watching as you tick off the list of things to do, looking forward to whats next w/ compcache.

Also, thanks to overpower and dixxa for their assistance!
[G1 Android Development] cyanogen:
http://code.google.com/p/compcache/issues/detail?id=34
[G1 Android Development] yukkio:
So... that means Compcache does not work as it would have?? Should I use swapper for now?
[G1 Android Development] jasherai:
This bug report is for the newer 0.6 version which has an issue. The current roms include 0.5 which appears to be working fine.

hth

jasherai
[G1 Android Development] yukkio:
Thanks.

I removed Swapper but I've a linux swap partition. I need to delete that partition to can enable compcache??

BR.
[G1 Android Development] ttabbal:
No. You can use either or both depending on what you want to do.
[G1 Android Development] martinx817x:
actually I am using cyanogen's newest rom. I got compache to finally work, and thanks to your script I can switch back and forth! Thanks for all your hard work.
[G1 Android Development] smuvman:
glad i searched

i was going out of my trying to figure out why i kept getting so many fc's. this is exactly whats happening with my g1. im using cyanogens latest with compcache enabled and it was soooo fast but now im getting the fc's. anybody know how to fix it? btw im using the .sh file from the 1st page.
[G1 Android Development] jasherai:
Thats great news! Let us know how well compcache works out for you.

jasherai
[G1 Android Development] sha.goyjo:
all the things I wrote made no sense :-
[G1 Android Development] pinetreehater:
I noticed a couple of pages back where someone stated the device got significantly slower after installing a theme and wiping. Happened to me too.

Anyway, I have notice people mentioning using both a linux swap partition and compcache. I cannot find info on the linux swap (searching was futile...too many post have this term).

Can some direct me to info on installing and using the linux swap. I want to try using both, since I just reflashed CM (because of the lag that I think was caused by the theme....gonna run it naked from now on).
[G1 Android Development] yukkio:
Ok, If I uninstall Swapper and free command shows swap memory from compcache? I have a linux swap partition of 32mb and free command shows 32mb of swap so i dont know if compcache is running... because i've read Cyanogen sets swap to 20mb... :confused:

Thanks, BR.
[G1 Android Development] ttabbal:
Cyanogen's roms don't enable swap by themselves. What's the output of "cat /proc/swaps" ?
[G1 Android Development] yukkio:
Here's:

Filename Type Size Used Priority

/dev/ramzswap0 partition 31996 15084 -1

BR.
[G1 Android Development] martinx817x:
if you go to page 21 and scroll to the bottom there is a script available for you to use and also instructions on how to enable swap or compache. Thanks to jasherai and dixxa
[G1 Android Development] spinjason:
copying userinit.sh to /system/sd

Ok, I am unable to get AndExplorer to copy/cut/paste to /system/as. Do I have to use ADB? Is there another file manager app that will do it?
[G1 Android Development] ttabbal:
That's a 32MB compcache. Looks like you've got that bit working at least. You are using 15MB of it, how's performance?
[G1 Android Development] ttabbal:
adb will work, there's also the terminal, that's how I do this stuff.
[G1 Android Development] spinjason:
Mine works great !
[G1 Android Development] spinjason:
Can you show me the commands? Thanks..
[G1 Android Development] h.nocturna:
Terminal commands:

$su

#cp /sdcard/userinit.sh /system/sd/

Restart phone to get script running and presto.
[G1 Android Development] mexpress22:
theres also the option to use sufbs (root level file manager).

You can mount rw, system and data, with one click, copy and paste, and in this case run scripts avoiding the need to reboot first.

It also has a built in text editor so once moved you can simply access /system/sd/userinit.sh and adjust settings to say swappiness of 60 to swappiness of 30.
[G1 Android Development] h.nocturna:
Oops, I forgot the mount command after su. Mount it first or it won't let you write to /system/
[G1 Android Development] TheMan42:
I know that the script will work with 3.6.8.x - but if I decide to use this, will the default settings from the script be fine, I see a lot of people adjusting the swappiness of compcache constantly. How would I be able to perform that via terminal or ADB?
[G1 Android Development] h.nocturna:
You don't do it via terminal or ADB. You open the userinit.sh file with notepad or something similar. Change the numbers or commands, then save the file and re-push it over. Make sure it overwrites the old one. For your first try I suggest something like 20swappiness and make you turn on linux-swap as well for an even more noticeable speed up.
[G1 Android Development] yukkio:
No really, I think Web Browser gets all that compcache :)

Anyway I'm happy with this rom considering I've a Magic hehe.

BR.
[G1 Android Development] TheMan42:
Thanks bud, i'll give it a try out :cool:
[G1 Android Development] SRT102JZ:
so how do i go about getting BOTH linux-swap AND compcache working? ive got the lixux-swap partition setup at 32mb but dont know what else to do from here.

my compcache disksize at 16mb

my compcache swappiness is set at 20

heres a copy of my userinit.sh that i pushed to system/sd:

what other things must i do to make sure or atleast check if both the linux-swap AND compcache are working? im a noob when it comes to this stuff

thanks.
[G1 Android Development] h.nocturna:
change disksize_kb=16000 to:

memlimit_kb=16000 backing_swap=/dev/block/mmcblk0p3;

that should do it

On another note, what swappiness or size ramzswap are other people using what is their performance after a day? Mine fills up after a few hours using a 24000kb memlimit and a swappiness of 40 and really bogs down and I am forced to swapoff/swapon.
[G1 Android Development] pinetreehater:
I wonder if compcache is working (I posted this to the CM 3.9 thread too).

I have two G1's. Both have brand new installs of CM 3.9. One has compcache (with swapiness set to 20 and 24mb of space allocated) and one does not. After a reboot on both devices and waiting a five minutes for everything to settle, I filmed the opening of the camera app. The one without compcache is noticeably quicker. Is compcache slowing our machines down, at least in certain instances?

By the way, cat /proc/ramzswap confirms compcache is enabled.

http://www.youtube.com/watch?v=gNYv-5WLDVA
[G1 Android Development] simplyTravis:
Compcache tweakery

I've been trying to find my happy medium on what I should run on this phone and I think I found it. I was running 60 swap at 16mb which was blazing fast until about 7 hours after I ran it. So I tried 20 swap at 16 mb and that was horrible.

Right now I'm running at 40 swap and 8mb just to shake things up. My free ram is staying pretty high now and seems to work better at the early boot. I am running 6 widgets and 5 services outside of the sim toolkit and touch input. Also I am running on dxTop which goes back and forth from being resource hungry but it is useful.

Does anyone else run their phone like this or worse? How is your performance with compache?
[G1 Android Development] h.nocturna:
Running JACHero2.7.4 with compcache set at 64MB and 20Swappiness and seems rather responsive.

With that out of th way. Does anyone know how to run compcache dynamically in parallel with the linux-swap. I mean, once my compcache loads something, it doesn't let go, it just keeps filling and filling till the whole phone is bogged down. Is there a way to have things that aren't as active transfer to linux-swap and once not used at all just be removed from memory?
[G1 Android Development] innerspace:
I've been chatting with overpower about altering the way compcache works with android to prioritize what processes get swapped. I need to get a better handle on how exactly how ramzswap and backing_swap work together. We've been fiddling with a number of ideas via PM, I'd imagine he'll chime in on this soon, he seems to have a solid grasp on the subject.