yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] senaia:
forgive my noobish noobyness, but this is really bugging me, i see all these logs with goodcompress at 100%, but no matter what i do, i never get 100. earlier in the thread i started using mike's conf but changed powersave to 200 (something about it playing havoc with xrom) and got 69%, now i'[ve reformatted my sd card and have a 32mb swap partition, using same conf but set ccbacking swap to 0 and linux swap to 1 as you would expect, now i'm getting 82%... how do i get it up to full 100 or is it just trial and error, changing settings all the time till i get it?

current stats (i need to upgrade my sig)

CM 4.0.2

systemforce3 theme (thanks prash, awesome work)

32mb linux swap, 512 ext4, whatever was left from 8gb fat32 (ok, i'm cheap my sdcard is only class2)

fresh fresh install, full SD wipe, wiped phone before flashing 4.0.2

any tips, or trial and error?
[G1 Android Development] Binary100100:
Do you have anything like this in your user.conf. Bold are required for 100%

*** CompCache ***

compcache_en=1

cc_memlimit=20

cc_disksize=24

cc_backingswap_en=1

cc_backingswap=/dev/block/mmcblk0p3
[G1 Android Development] miketaylor00:
You will only get 100% compression if you are using Compcache with backing swap. It sounds like you didn't have a linux-swap partition the first time around so even though it was turned on, backing swap could not be used. If you added linux-swap partition you should be able to use my config as it is. The reason why you aren't getting 100% compression with linux swap enabled is because compcache isn't managing it. When compcache is unable to compress it, it gives it back to the OS to handle it and reports to you what % of memory it could compress. When backing swap is turned on, Compcache manages the compression as well as the swapping. It seems to be more efficient to me to run it that way because Compcache is controlling everything instead of handing stuff back off to the OS to deal with.

As far as your powersave bias goes, try it with it set to 0 unless you really are worried about battery life. I've had people tell me it works better on Cyan ROMs with it turned off if you are using my other settings. It doesn't make a lot of sense on the surface but sometimes slowing down your processor a little bit will speed things up in certain situations. Most of the times that I have seen it, it has been caused by poorly written code. The processor allows so many requests to be made that when they hit the bottleneck of poor code, the entire sytem becomes bogged down. Slowing down the processor a little makes it so that fewer requests get sent through and that tipping point is never reached. Rather than being really responsive at first followed by really slow, you get a constant level of performance that makes for a better user experience. However, I think in this case the problem was with the memory management settings not Cyan's ROM. The memory was not being moved around fast enough so things got backed up, swapping increased, and the phone would slow down. Try it out. If you still feel that having the powersave bias at 200 helps let me know.
[G1 Android Development] motivecc:
i'm currently using cyanogen 4.0.1 and would like to test out some compcache configuration settings to see how they work out, but i can't seem to get them to work...

i DO NOT have apps2sd setup, therefor the a2sd script that is included with the stock 4.0.1 cyanogen ROM seems to not work with userinit.sh and user.conf because the script is looking for these files in the root of the ext partition, which obviously i do not have...

i've attempted to edit the a2sd script to look for the two files in the root of my sdcard instead, by editing the following

# call a userinit.sh script if it's present on the sdcard
# otherwise just enable compcache with no backing swap
if [ -e /sdcard/userinit.sh ];
then
echo "--- Executing userinit.sh"
busybox chmod +x /sdcard/userinit.sh
/system/bin/sh /sdcard/userinit.sh;
else
modprobe ramzswap;
/system/bin/rzscontrol /dev/block/ramzswap0 --init
swapon /dev/block/ramzswap0
fi

the stock a2sd script was using the if variable

if [ -e /system/sd/userinit.sh ];

i also edited the userinit.sh file to look for the user.conf file in the /sdcard rather than /system/sd... i have pretty much no programming background, but from all this syntax that i changed, i didn't really find fault in it since it was just changing file directories due to the nature of the /system/sd not being available in my case...

the error that i get from compcache is as follows when i run the command

#sh /sdcard/userinit.sh -s

=== CompCache status ===
CompCache version 0.6+
Compcache enabled
CompCache: DiskSize 24452(system) 32768(user)
!!! Unable to set compcache cc_swappiness to user specific "28"
Current system value is "60"

=== CompCache status output ===
DiskSize: 24452 kB

## the rest of the output i assumed would not be needed for my question

if anybody could help me with this, i would appreciate it... i'm fairly certain the solution to my problem is simple, i just can't figure it out on my own as i'm learning everything from scratch... and this is on a mytouch 3G, which i also assume may have some relevance in the issue...

the config files that i am using are 1.4.1, and all i did as you can see from the output is attempt to change the disksize of compcache to 32, and swappiness to 28 using notepad++... i've also tried using it in administrator mode and that yielded the same results
[G1 Android Development] huanyu:
I haven't got time to do more experiments on the backingswap with swap file yet. Maybe this weekend.

The /sdcard is not mounted in the a2sd script, so it won't find any thing in /sdcard.
[G1 Android Development] motivecc:
can anybody shed some light on this issue then? would it be easier for me to find and edit the default settings for compcache and resign cyanogen's package myself, or edit the a2sd script by mounting a different directory in order to utilize userinit.sh and user.conf without having to have apps2sd? i find that my mytouch slows down more with apps2sd (on my class 6 16gb... i've verified transfer speeds are indeed within range of class 4 - 6ish speed myself), and would like it if i were able to play with the disksize and swappiness to optimize speed and minimize home screen loads... also, by default from my reading, 1/4 of the RAM is allocated for compcache, and on the cyanogen ROM its using the disksize for the G1 for the mytouch since these default settings are not changed when the mytouch is detected and installed...

since the RAM size should be around 192mb for the mytouch, default settings should be set to around 40 - 48 mb for disksize and probably around 50 - 60 for swappiness from my tinkering that has produced optimal results on the g1... also, being able to utilize backing swap with this increased disksize for compcache should in theory yield some stellar results along with a possible increase capacity with backing swap, and i'm hoping page reloads for the browser and homescreen would be minimal if i were able to mess around with these settings without apps2sd...
[G1 Android Development] tman7510:
cant change cc_memlimit?

I'm currently running cm_4.0.2 on my G1 with userinit v1.4.1 and dont seem to be able to change the cc_memlimit. I have it set to 24 in my user.conf but the system keeps coming back with 14 when I check the comcache status? The strange thing is when I had it set to 16 I had 16 available now I have it set to 24 but it shows up as 14 :confused:
[G1 Android Development] huanyu:
if you just wanna to disable a2sd, you can try the modified a2sd that i used. it reads /system/sd/user.conf for app2sd parameter. If you set apps2sd=0, it won't do the app2sd.

Interesting, i will check this out over the weekend as well. Can you show me the outputs of userinit and userinit -s

edit: uploaded the correct working version ( i hope, as i don't have G1 with me atm )
[G1 Android Development] iso67:
may I use those files with jacxHerosky 1.5r2?
[G1 Android Development] motivecc:
like i stated in my original post, i already have a2sd disabled, but want to change compcache settings... you can't with the current way cyanogen's rom and a2sd script are set up with userinit.sh and user.conf
[G1 Android Development] miketaylor00:
Yes, you can. Run the usernint.sh script in this thread. Then update your user.conf. I promise you that will fix it. His A2SD script only updates compcache settings if your userinit.sh script does not exist. If it does exist, it defers to those settings.
[G1 Android Development] rbgmode:
Let me get this straight I been using swap with linux

Basically compcache and linux enabled

Backingswap set off.

But does backing swap manage/use my linux-swap partition 32mb or not?

Debating if turn it on.

I know they both can't be turned on @ the same time.

I heard many contradicting comments on if increasing linux swap partition size does anything good or bad. The same for compcache swap.

One thing figured is that backing swap compressed and decompressed would this not use more processor time to do? What if just have raw uncompressed data.

I'm a n00b @ this so what method keeps all uncompressed.

Or is compression good?

If anything I stated here sounds stupid let me know and correct my errors.
[G1 Android Development] miketaylor00:
I've been doing A LOT of research on this lately so hopefully I can answer your questions. If you are running a Linux OS (Android is Linux based) you want to have some type of swap setup to extend the amount of memory available to the OS. So it is pretty much a given that you want to use some type of swap if it is avaiable to you on the ROM you are running.

Compcache was designed to make better use of a small amount of RAM on devices with limited resources (like our phones). If RAM was abundant on these phones there wouldn't be much use for it. Unfortunately it's not. Compcache uses compression which does requires more processor but on the plus side it is using RAM which has a faster data transfer rate than a hard disk or in the case of our phones SD card. Depending on which class of SD card you have it may not be as big of a difference.

Some types of data just can't or shouldn't be compressed. That data has to sit somewhere in memory and at some point you are going to run out of RAM. That's were linux swapping comes in. It extends the memory so that the phone isn't constantly having to decide which data to dump to respond to the new requests that you are making. You don't want to have to have your desktop reloaded every time you hit the home button to return from an application that you are using.

As I said before, extending your memory with swap is pretty much a good idea no matter what if it is an option. The key is to make sure that it is configured properly. You can find a few of my thoughts on that here: http://xdaforums.com/showthread.php?p=4391204) So the next question is, which is better regular Linux swap or backing swap. I've heard that previous versions of Compcache were less efficient than the OS. But all of my testing on v0.6 show that it isn't anymore. By using backing swap, the ram disk and the swap disk are both being managed by Compcache rather than having to hand things off back and forth with the OS.

Like I said, I've been trying to wrap my head around it for a while. I hope I explained it well enough.
[G1 Android Development] miketaylor00:
The location of the userinit.sh and user.conf don't really mean much. JAC has modified this and uses a file called swap that is really close to the same thing as the userinit.sh. His swap and user.conf file are located in the /system/bin/ folder which makes sense to me, especially when you think about the question you brought up. What if someone wants to use this but doesn't have an ext partition. I don't see any reason why you couldn't have a folder called /system/sd/ that was not an ext partition. However, it might make things a bit confusing to have that folder and not have it be an ext partition. If you do want to change the location you need to modify this line in the userinit.sh

CONF_FILE="/system/sd/user.conf";

Also, make sure you turn off all of the features that would use the ext partition. It wouldn't make a lot of sense to move your media folder to a non-ext folder. You would still have the benefit of turning on compcache without backing swap, adjusting CPU settings, and using the VM settings.
[G1 Android Development] motivecc:
take a look at the code closer in cyanogen's a2sd script for 4.0.1... i'm not a programmer by any means, but its obvious to me what you're telling me is false... the script to activate userinit.sh settings looks SPECIFICALLY in the root of the ext partition... how would it not matter, it checks no where else... i followed the directions to the T and it never worked, even with the unmodified default settings userinit.sh comes with... i get the same error, and the disksize never changes, even though it states my user settings... when i do what you're tleling me to do, it doesn't detect my "user" settings cause obviously i have no ext partition and the a2sd script did not detect anything, but when i modify the script for the file locations, it does recognize my user settings

when i make the changes that i did, it found the userinit.sh file and detected my user settings, but it won't change the compcache settings to what i'm wanting... also, editing the first line of code in the userinit.sh to the directory of where i'm actually placing my files didn't help either... i already tried that before you suggested, i've gone line by line through the code in his a2sd script, userinit.sh, and user.conf to edit any possible mismatches in directory locations but it doesn't help... i've tried it without modifying the files, it doens't work, i modify the files but then i get the error in my original post...
[G1 Android Development] huanyu:
so what you trying to do is to read /sdcard instead of /system/sd or just disable apps2sd in a2sd script. or you are trying to use the userinit.sh without ext partition (mounted to /system/sd. Can you be more specific of what you trying to do?
[G1 Android Development] worldestroyer:
I'm in a similar situation, I don't want to use app2sd but I want to use my own userinit.sh and user.conf. My sdcard is entirely fat32 (when I tried to leave a swap, the phone would keep crashing at the loading screen). Where should I be putting the userinit.sh and user.conf? Whenever I try to push them to that folder it says it's read-only. Is there anyway to have CM 4.0.2 look at /sdcard for my userinit.sh and user.conf?
[G1 Android Development] huanyu:
I am not sure this a2sd script will work or not as i don't have G1 with me. As you don't have a ext partition, you can just push the a2sd to /system/bin (make sure remount your system as rw before you push the script).

the a2sd mounts the the first partition (must be vfat) of your sd card to /sdcard .

Edit, umount /sdcard after userinit.sh
[G1 Android Development] miketaylor00:
LOL. Take a closer look? Ok. I guess you don't need my help or Huanyu's help since you obvioulsy can read the code better than we can. And you know better than Cyan how it works too right?

I've gone back and re-read all of your posts and you haven't explained exactly what you want to do or what you have tried. Cyan doesn't use the apps2sd flag in the userinit.sh. You have to modify his a2sd file if you don't want to use apps2sd. Huanyu already told you how to do that.

If you want to modify your compcache settings you have 2 options. Rewrite Cyan's script or do what he suggests. Install the userinit.sh and then modify the user.conf to have the settings you are looking for.

If you really want us to help you, do the following. List your specific goals. Attach your a2sd file, user.conf, and userinit.sh file as well as the output from when you run sh /system/sd/userinit.sh -s (if you changed the location run it from where you have it).

I really think you are heading in the wrong direction though. Turning off a2sd is just going to fill up your phone's internal memory which will make less of it available to compcache. Increasing your swapiness is going to cause the phone to swap a lot more instead of using internal memory too. So, if I understand your post from the other day, you want to use your RAM to store relatively static data that doesn't change much and use your SD card for constantly changing data that is accessed often. I don't think that will give you the results you are hoping for. I can go into more detail on why if you'd like but you seem to have your heart set on going down this path so I don't want to spend a lot of time trying to convince you.
[G1 Android Development] worldestroyer:
How does that work? I thought a2sd just saves you space on your internal flash memory, not your active memory which is what compcache actually works in. Doesn't compcache dynamically compress the active system memory for optimal utilization, and only uses internal flash when you have a swap enabled?
[G1 Android Development] worldestroyer:
Thank you! I took a look at your script and decided to edit CM's 4.0.2 a2sd script based on the changes/edits you made. I pretty much made it look for 3-partitions instead of just 2 before it kicks off the app2sd portion of the script, therefore you can run compcache with backingswap enabled using a swap partition on a sdcard that has no ext2/3/4 partition.

My only question is the symbolic_link() in the userinit.sh has is trying to mount /dev/block/mtdblock3 i.e. "busybox mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system". What is that trying to do?
[G1 Android Development] rolflin:
About user.conf

Maybe you can show us more about compcache tunning and what option seems to work better with cyanogem 4.0.2

fat32+ ext3 + swap

I really don't know what works better for this terminal(G1)

I am using compcache + backswaping + VM and it works really fast.

100% comp.

I was trying to see diferences using

compcache + linuxswap + VM and it goes down to 71% of comp pages.

Has anyone made this kind of fine tunning?

Edit:

I've checked the correct post, anyone who wants to tweak it..go for it!

http://xdaforums.com/showthread.php?t=547752
[G1 Android Development] huanyu:
This is correct, ... but compcache does not use the internal flash as backingswap. Most of the cases, refer to the swap partition of your sd card.

You welcome, his just remount the /system with read and write permission so i can create a symbolic link. Instead typing the full path (eg. /system/sd/userinit.sh), this allows you to run userinit from anywhere
[G1 Android Development] nyijedi:
EDIT: Nevermind! Sorry!
[G1 Android Development] miketaylor00:
Backing swap using swap file

Ok, so I have tested backing swap with swap file and here is what I have found. There is nothing wrong with the userinit.sh. I've done the same things that it is doing manually and it will still give me the "invalid argument" error when I try to swapon /dev/block/ramzswap0. I can do the exact same steps using a swap partition and it works. The only variable is changing the -b option to be /system/sd/swap.file instead of /dev/block/mmcblk0p3. Rzscontrol will accept it as a valid parameter. If I spell it wrong, rzscontrol will give me an error. The problem comes when I try to swapon ramzswap0. For some reason, swapon see it as an invalid parameter.

Huanyu, I hoped by telling you this you wouldn't have to search through your userinit.sh script. The problem isn't there. It is with enabling compcache with swap file to swap. For some reason swapon sees it as an invalid argument.
[G1 Android Development] huanyu:
I am aware the error occurs when execute the swapon. It is still could be the problem of the swap file created by userinit. The userinit.sh creates a swap file with 1k block size (maybe i should make this adjustable for next release), which maybe a incorrect block size for ramzswap (even its not complain about it). The swap file is created properly as i have just simply test it as linux swap.

if you look at http://compcache.googlecode.com/hg/sub-projects/rzscontrol/man/rzscontrol.html

But it could be simply a bug in current CC version. Needs some more experiment to find out what is wrong.
[G1 Android Development] miketaylor00:
I did it all manually and made sure the swap file worked. It is a valid swap file and I made sure it wasn't in use. Maybe you are right about the block size. I will play around with it. Either there is something CC doesn't like about the swap file or it is a bug like you said. If you have any other ideas besides the block size let me know and I will test them out for you.

Edit: I opened an issue with the Compcache project on this.

/
[G1 Android Development] huanyu:
nice... I think its the problem with Compcache or kernel. I am able to compile CC modules and use it with swap file without any problem.
[G1 Android Development] RAQemUP:
I am having a problem with my user.conf.

I am basically using the settings miketaylor00 posted but with a cpu min frequency of 245760. My problem is that the GoodCompress is only at 68% or 69%.

My G1 is running CM 4.0.4 and I did not edit the userinit.sh in anyway.

I installed and tested with the Terminal Emulator according to the 1st post.

Also I have another question. If I decide to go back to the stock compcache settings that installed with the CynogenMod, how would I do that?

# User.conf by miketaylor00
# General parameters
general{
apps2sd=0	# this is useless here, require a modified a2sd script
media2sd=1	# moves the medias to sd if /system/sd/media exists
}

#compcache related parameters
compcache{
compcache_en=1	# enable(1) or disable(0) compcache
cc_disksize=32	# Ram swap disksize - any number between 1 to 95 should work
cc_memlimit=18	# Limite the memory usage when backing swap is used
cc_backingswap_en=1	# enable or disable backing swap
cc_backingswap=/dev/block/mmcblk0p3 # pointing to the backingswap partition device
cc_swappiness=28 # default 60
}

#create swap file for compcache or linux swap
swap_file{
swap_file_en=0	# set to 1 to create swap file
# set to 0 to del the swap file
linux_swap_file_size=32	# swap file size in MB
linux_swap_file=/system/sd/swap.file	# pointing to the swap file location ( must be /system/sd/)
}

#Linux swap parameters
#
# linux swap can only be enabled if cc_backingswap_en is set to "0"
#
linux_swap{
linux_swap_en=0	# enable(1) or disable(0) linux swap
linux_swap_partition=/dev/block/mmcblk0p3 # swap partition device
swappiness=30 # default 60
}

#virtual memory
sys_vm{
sys_vm_en=1	#enable(1) or disable(0) virtual memory configurations
page_cluster=3	# default 0
laptop_mode=0	# default 0
dirty_expire_centisecs=3000	# default 3000
dirty_writeback_centisecs=500	# default 500
dirty_background_ratio=5	# default 5
dirty_ratio=10	# default 10
}

#cpu clock
proc_cpu{
proc_cpu_en=1	#enable(1) or disable(0) user cpu configurations
# freqency options
# 19200
# 122880
# 128000
# 245760
# 384000
# 528000
scaling_min_freq=245760	# default 245760
scaling_max_freq=528000	# default 528000
sampling_rate=2000000	#default 2000000 depending on kernel version
powersave_bias=0	# default 0, CM3.9.6 default uses 200
up_threshold=45	# default 40, percent cpu usage before going up a speed step
}
[G1 Android Development] drpfenderson:
Just remove userinit.sh and reboot. ;)
[G1 Android Development] worldestroyer:
Could you show us the userinit.sh -s ?
[G1 Android Development] mfrey0118:
ok up to this point I have only used swap partitions. Now I would like to use compcache. So I followed instructions to download, copy to phone system, and elevate privileges with these scripts. And I turned swap off (swapoff -a), and rebooted and my swap partition is no longer being used.

However, when I type in "sh /system/sd/userinit.sh -s" I get insmod: can't open,,,(long filename)

and it says /dev/ramzswap0 no such device or address...

Help? I am using Terminal, not ADB...
[G1 Android Development] IOmega666:
this works for Hero too right ?