Compcache + backing swap in newer CM ROMs - G1 Q&A, Help & Troubleshooting

Hello!
I have a G1 using CM 4.1.999, and my microSD is partitioned with an ext4 for apps2sd and a 64MB linux-swap partition.
I am using the user-configurable userinit.sh with user.conf.
I am trying to understand the cc_disksize and cc_memlimit settings.
My understanding is that it used to be that no matter how I set these I will get a compcache of 15% of total RAM with a backing swap using the entire linux_swap partition.
But I am a bit confused as this rom has compcache 0.6, and I am not sure if that limitation still applies after .5x.
If that is the case, I want to confirm... if I set cc_disksize to 0 and set cc_memlimit to 32, I will get a RAM compcache of 32MB, and it will use the entire linux_swap partition as backing swap.
Is this correct?
Thanks for any help you can give me in understanding this!

Sorry for the bump, but I'm hoping a little more clarification might be a little more answerable...

Well i cant give you a definitive answer, but i can point you in the right direction.
If you don't get much help here, you can try PM'ing miketaylor00
he spent considerable amount of time talking about the subject and his user.conf is implemented in JACxROM
you can send him a link to this q&a and maybe he'll help you out. im sure a lot of people would like more clarification
i also believe the defaulting to 15% of ram was fixed in 0.6 compcache
i havent messed with these settings much. i messed around with them when they first came out but stopped after 0.6 and just started using whatever was included default in the rom. swappiness was pretty much the only settings i changed

bradycl_84043 said:
Hello!
I have a G1 using CM 4.1.999, and my microSD is partitioned with an ext4 for apps2sd and a 64MB linux-swap partition.
I am using the user-configurable userinit.sh with user.conf.
I am trying to understand the cc_disksize and cc_memlimit settings.
My understanding is that it used to be that no matter how I set these I will get a compcache of 15% of total RAM with a backing swap using the entire linux_swap partition.
But I am a bit confused as this rom has compcache 0.6, and I am not sure if that limitation still applies after .5x.
If that is the case, I want to confirm... if I set cc_disksize to 0 and set cc_memlimit to 32, I will get a RAM compcache of 32MB, and it will use the entire linux_swap partition as backing swap.
Is this correct?
Thanks for any help you can give me in understanding this!
Click to expand...
Click to collapse
Yes, your assumptions are correct. If you have backing swap enabled it will use the entire swap partition. You can check the stats with this command:
Code:
su
rzscontrol /dev/block/ramzswap0 -s
The disksize value when you have backing swap enabled should always equal the size of the swap partition. I recommend a 32MB swap partition if you are using a ROM that doesn't have BFS and a 64MB swap if it does have BFS.
The memlimit is the amount of uncompressed data that can be used by compcache. It usually compresses down to about 20-25% of the uncompressed size so with a 32MB setting it will only use about 5-8MB of RAM. I've been using a 32-48MB memlimit lately and it works great. If you are on a BFS ROM I would go with 48MB. I believe that CM is using BFS I just wanted to give the info for both in case someone else reads this down the road. There is a lot of info about the stats on this page.
http://code.google.com/p/compcache/wiki/StatsExplained
If you have any more questions shoot me another PM. I hope this helped.

Related

EXT Filesystems

Okay so when we first had apps to SD, we used an extended partition called EXT2. And then cyanogen and all the other devs decided that ext2 wasn't as good as ext3. Now I realize that there's an ext4. So my question is, is there an infinite list of ext filesystems and is it a coincidence that ext2<ext3<ext4?
The question relies on a bit of history.
ext - (extended file system) which was a file system used in minix and *nix.
ext2 (second extended file system) was a replacement for ext. Primarily this allowed for larger files and longer file names.
ext3 was the replacement for ext2... intuitively enough. the most important thing it added was journaling. There were quite a few other changes but the journal is the reason ext3 is favored for the G1. The short version is that an journaled file system is less likely to become corrupt if not powered off correctly.
ext4 extends ext3. From a G1 perspective the main things it provides is some performance improvements as well as journal checksumming. There are quite a few other changes but most will not be pertinent to an embedded environment. Check wikipedia if you want a complete list.
Ext2 to ext3 is completely backwards compatible - if you make a partition ext3 you can still mount it as ext2, you just lose the journal capability while doing so.
Ext3 to ext4 is not backwards compatible if extents are used. Truthfully, unless you map extents to a smaller multiple of block size of your flash card using extents on an SDHC would probably not be advisable. People enable it with the default 128MB extent size and 4KB block size none the less. It would be a long discussion as to why this is non optimal considering a flash block size of 128KB (page size 64KB I believe) but it is not worth having.... most people enable it and so ext4 in most cases will not be backwards compatible.
EDIT: As of this moment there is not an EXT5 on the horizon. Most next gen file system work on Linux is concentrating on BTRFS and a few others whose names escape me.
EDIT2: added block size to EXT4 extents to be clearer.
JanetPanic said:
The question relies on a bit of history.
ext - (extended file system) which was a file system used in minix and *nix.
ext2 (second extended file system) was a replacement for ext. Primarily this allowed for larger files and longer file names.
ext3 was the replacement for ext2... intuitively enough. the most important thing it added was journaling. There were quite a few other changes but the journal is the reason ext3 is favored for the G1. The short version is that an journaled file system is less likely to become corrupt if not powered off correctly.
ext4 extends ext3. From a G1 perspective the main things it provides is some performance improvements as well as journal checksumming. There are quite a few other changes but most will not be pertinent to an embedded environment. Check wikipedia if you want a complete list.
Ext2 to ext3 is completely backwards compatible - if you make a partition ext3 you can still mount it as ext2, you just lose the journal capability while doing so.
Ext3 to ext4 is not backwards compatible if extents are used. Truthfully, unless you map extents to a smaller multiple of block size of your flash card using extents on an SDHC would probably not be advisable. People enable it with the default 128MB extent size and 4KB page size none the less. It would be a long discussion as to why this is non optimal considering a flash block size of 128KB (page size 64KB I believe) but it is not worth having.... most people enable it and so ext4 in most cases will not be backwards compatible.
EDIT: As of this moment there is not an EXT5 on the horizon. Most next gen file system work on Linux is concentrating on BTRFS and a few others whose names escape me.
EDIT2: added page size to EXT4 extents to be clearer.
Click to expand...
Click to collapse
oo Awesome, THanks for the response. Cleared things up. Another thing...why didn't developers start with EXT4 then?
Ext4 support wasn't built into Android - Cyanogen (I think, don't mean to step on anyone's toes) added it in. And it is still a pretty new file system type, so after patching in support, Cyanogen still had to go back and bring in some newer patches to try and fix bugs.. It's very cutting edge still. Given time, it'll be the "standard" and we'll be poking at some other new file system and wondering why everyone doesn't use it.
The original kernel for android would not have supported ext4, since it was not available at the time of the G1 release.
I am going from memory but I think the cupcake release used a 2.6.27 kernel. This would have been before ext4 support was released for general consumption, though it might have been available under experimental.
Cyanogen and most of the custom ROMS out there are using a 2.6.29 kernel now, which has a general release of ext4. There are some known problems with the stock ext4 release in 29 but Cyanogen backported the fixes from 2.6.30. Since I believe most of the ROMS are "Cyanogized" you should be fine now with any of the current ROMS on a 29 kernel that supports ext4, which is not necessarily all of them. I pretty much stick to Cyanogen's ROMs so I can not say what the others do and do not have.
Saiboogu said:
Ext4 support wasn't built into Android - Cyanogen (I think, don't mean to step on anyone's toes) added it in. And it is still a pretty new file system type, so after patching in support, Cyanogen still had to go back and bring in some newer patches to try and fix bugs.. It's very cutting edge still. Given time, it'll be the "standard" and we'll be poking at some other new file system and wondering why everyone doesn't use it.
Click to expand...
Click to collapse
JanetPanic said:
The original kernel for android would not have supported ext4, since it was not available at the time of the G1 release.
I am going from memory but I think the cupcake release used a 2.6.27 kernel. This would have been before ext4 support was released for general consumption, though it might have been available under experimental.
Cyanogen and most of the custom ROMS out there are using a 2.6.29 kernel now, which has a general release of ext4. There are some known problems with the stock ext4 release in 29 but Cyanogen backported the fixes from 2.6.30. Since I believe most of the ROMS are "Cyanogized" you should be fine now with any of the current ROMS on a 29 kernel that supports ext4, which is not necessarily all of them. I pretty much stick to Cyanogen's ROMs so I can not say what the others do and do not have.
Click to expand...
Click to collapse
Ah Thank-you both of you. Cleared things up alot
This explains it nicely! Ext4 for cyan. Is it still a good idea to run the linux swap partition as well with ext4 and Cyan roms?
yes
you still want to run a linux-swap partion, swap and ext are 2 different things. Swap is where your system extends it's operating memory not storage as to say even a full computer linux distro uses a swap partion<I know my ububtu does> so yes if you want the benefits of swap than you better have a partion for it
Awesome..
Thanks to alritewhadeva for rising this question and thanks much to Saiboogu and JanetPanic for letting us win users what exactly these are for. Couldn't find better explanation even after googling about them.
gridlock32404 said:
you still want to run a linux-swap partion, swap and ext are 2 different things. Swap is where your system extends it's operating memory not storage as to say even a full computer linux distro uses a swap partion<I know my ububtu does> so yes if you want the benefits of swap than you better have a partion for it
Click to expand...
Click to collapse
Regarding this linux-swap.... I do have 32MB partition for that one created before installing the ROM. Now, are cyanogen's roms take advantage of this partition automatically or do I need to "enable" or change setting for that to happen?
If you read the first post on cyan's rom, I believe it does but as compcache, which I believe and I might not be right but I think it is just a better way of swap, I think more efficent
I repartitioned today to ext4. I used cyan's userint.sh and Mike Taylors user.conf. I'm not convinced it is working right at it seems more sluggish at times.
I just use a 96mb linux swap myself that I turn on with swapper and it is quite snappy, there was a thread were people were saying that comp wasn't as good as swap so I decided doing all that was just a hassle so I stuck with tried and true swap
This is the MT user.conf and the one I'm running.
# 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
}
#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=192000 # default 245760
scaling_max_freq=528000 # default 528000
sampling_rate=2000000 #default 200000 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
}
gridlock32404 said:
If you read the first post on cyan's rom, I believe it does but as compcache, which I believe and I might not be right but I think it is just a better way of swap, I think more efficent
Click to expand...
Click to collapse
Compcache is different to swap.
Swap is a virtual extension of the RAM, which is why it gives us a performance increase. Although adding x amount of swap space isn't the same as adding x amount of RAM.
Compcache compresses what's in RAM, which in theory increases the amount of RAM
Compressing pages and keeping them in RAM virtually increases its capacity. This allows more applications to fit in given amount of memory.
Click to expand...
Click to collapse
I flashed to Cyan's lastest this morning. I assume that user.conf and userint.sh was replaced with Cyans own?
I'm super fuzzy on all this, as I will be running Cyan's roms from now on, I just need a system/setup/ext that's optimized for his roms. I didn't have much luck with MT's for whatever reason. It ran, just lagged.

JacHero 2.7.4r2 Compcache? Help

So I'm currently running JACHero 2.7.4r2, and I'm still encountering long loads htc screens and lag. I'm aware that compcache starts up automatically at boot and that its supposed to reduce lag ect, and help the rom smoother and works better than Swap linux. How is it that others are having so much success with their roms performance? Am I supposed to tweak the settings of compcache?
I did some research and this is what I got...
Edit the userinit.sh file you're using. Check the proper threads for compcache in development forums.
As far as Compcache vs swap, I've gone back to no swaps, it seems snappier by itself without these methods. It could be a personal preference though depending on what apps/services you use the most.
Click to expand...
Click to collapse
How do I get to the userinit.sh file? and what are good settings to use?
Also on the first page of JACHeroski2.7.4r2 it also says...
**Please do NOT use userinit.sh for Swap it is already done in this build and that will cause you to have swap issues
Click to expand...
Click to collapse
So I'm a bit confused as to what I'm supposed to do here. I'm also running a 32 swap linux partition, should i keep it? Or Remove it?
Thanks
Mine is running really good on linux-swap.... I'm not switching to CompCache until it's 100% ironed out.
So can we enable compcache? My class 6 might not arrive before I go on holiday (Tuesday) and Im thinking linux-swap will be too slow on a class 2 :-S
AdrianK said:
So can we enable compcache? My class 6 might not arrive before I go on holiday (Tuesday) and Im thinking linux-swap will be too slow on a class 2 :-S
Click to expand...
Click to collapse
Yes, you can enable compcache, its already on by default in 2.7.4r2. He said not to use userinit.sh for linux-swap as he already added command into a2sd.sh. So that's automatic as well. You can check if they're working by going into Terminal and typing:
#cat /proc/ramzswap
#free
#cat /proc/swaps
mines working but still is slow, ect. Is it cause its only experimental?
I think i found my issue, i reset overclock to be default so its NOT overclocked anymore, and i see improvements.
h.nocturna said:
Yes, you can enable compcache, its already on by default in 2.7.4r2. He said not to use userinit.sh for linux-swap as he already added command into a2sd.sh. So that's automatic as well. You can check if they're working by going into Terminal and typing:
#cat /proc/ramzswap
#free
#cat /proc/swaps
Click to expand...
Click to collapse
So compache runs automatically? So no need for a swap partition?
If you have compcache and a swap partition, you're going to have problems. Use one or the other.
goldenarmZ said:
If you have compcache and a swap partition, you're going to have problems. Use one or the other.
Click to expand...
Click to collapse
Or you might try using linux-swap as a backing swap for the compcache. If you wanna find out more, just check out the compcache tutorial thread.
So this is why my newest jacheroski lags that much.. But in the tutorial, there's nothing about disabling the compcache. So how can I remove it, or make linux-swap backing up compcache?
edit: I'd rather disable compcache, because I'm too lazy and not willing to create linux-swap in the future again. (gah, if there's something wrong in what I wrote - sorry, but my english isn't perfect. i'm trying ;p)
BolecDST said:
So this is why my newest jacheroski lags that much.. But in the tutorial, there's nothing about disabling the compcache. So how can I remove it, or make linux-swap backing up compcache?
edit: I'd rather disable compcache, because I'm too lazy and not willing to create linux-swap in the future again. (gah, if there's something wrong in what I wrote - sorry, but my english isn't perfect. i'm trying ;p)
Click to expand...
Click to collapse
It's easier to just delete your swap partition.. boot into recovery, enter console with [alt+x] and do this:
Code:
parted /dev/block/mmcblk0 rm 3
Its easy enough to create a new swap partition in the future.. just follow the instructions in the 1st post of the jachero thread again.
I've not looked into compcache so I'm not sure how to disable that.

swapper question...

hey guys, i would just like to make sure that my settings are correct. i have a 32mb linux-swap partition.
im running cyanogen ROM and my swap place (on swapper) is /sdcard/swapfile.swp
Under advanced preferences, i checked the option of "Use Swap Partition" with the swap partition of dev/block/mmcblkop3
i always get a swapfile.swp in my fat32 partition.
thanks
Pretty sure linux-swap is automatic with the cyanogen's...
Nah, compcache is automatic on all new cm roms, but I found that it causes me the coma issuse on wake with it so I just use swap for it instead
ok im confused. so swapper and compcache do the same job? if so, then ill just uninstall swapper
rpesigan6 said:
ok im confused. so swapper and compcache do the same job? if so, then ill just uninstall swapper
Click to expand...
Click to collapse
If compcache is automatic, and you want to use linux-swap, you need to extract the user.conf from /system/bin, change the settings (the instructions are in there), and then push it back over. But if you're already satisfied with the performance, leave the tweaking to those who are more knowledgeable.
yeah im satisfied with the performance. ok i just uninstalled swapper. so about compcache.... correct me if im wrong, but my cache is currently being stored into my internal memory. i believe this is so cause i would always have to go to manage applications to clear cache
compcache has nothing to do with your caches. Compcache is a set of modules that compresses paged data to allow you to "extend' the available memory. goto google, apply fu.

Best settings for CyanogenMod

Hey guys can you suggest me the perfect settings for my 2GB sd?
Do I need to use Swap? (now I have 64 mb of swap)
What kind of EXT it's best? (now I have ext4)
Thank you!
Krishath said:
Hey guys can you suggest me the perfect settings for my 2GB sd?
Do I need to use Swap? (now I have 64 mb of swap)
What kind of EXT it's best? (now I have ext4)
Thank you!
Click to expand...
Click to collapse
I believe ext4 is best, as it's the newest linux filesystem. I'm currently using ext3, because most ROMs don't support ext4, but I'll probably upgrade soon.
As for swap, I also have a 64mb swap partition, but default it isn't utilized. CompCache is already enabled, but I'd also like to know how to enable it.
EDIT: Swap requires a userinit.sh I'm about to try it out...
AdrianK said:
I believe ext4 is best, as it's the newest linux filesystem. I'm currently using ext3, because most ROMs don't support ext4, but I'll probably upgrade soon.
As for swap, I also have a 64mb swap partition, but default it isn't utilized. CompCache is already enabled, but I'd also like to know how to enable it.
EDIT: Swap requires a userinit.sh I'm about to try it out...
Click to expand...
Click to collapse
Yeah but what it's the best setting for this ROM?
EXT4 + SWAP 64MB are alright?
So swap partition isn't used by default? How we "activate" it?
Krishath said:
Yeah but what it's the best setting for this ROM?
EXT4 + SWAP 64MB are alright?
So swap partition isn't used by default? How we "activate" it?
Click to expand...
Click to collapse
Isn't much difference between ext3 and ext4. Cyanogen himself uses ext4, so...
You need to make a custom userinit.sh, follow that guide I posted.
Swap size probably doesn't matter too much, as long as it's not too big. 64 will be fine, any speed increase from a different size will be minimal.
This is how I'm running 4.0.4...
- 32MB Linux Partition - enabled using Swapper.
- 528MHz set ALL the time - enabled using SetCPU(Makes the UI sooo much smoother. Didnt really notice a difference in battery life either).
Using userinit.sh I enabled CompCache with linux swap on a 64 partition and it does seem smoother. Also switched to ext4 now, don't really see a difference.
Will try it now
AdrianK said:
Using userinit.sh I enabled CompCache with linux swap on a 64 partition and it does seem smoother. Also switched to ext4 now, don't really see a difference.
Click to expand...
Click to collapse
Can you post your usernit.sh?
AdrianK said:
Using userinit.sh I enabled CompCache with linux swap on a 64 partition and it does seem smoother. Also switched to ext4 now, don't really see a difference.
Click to expand...
Click to collapse
i would suggest you stick to ext3 because it's more commonly used as of right now... also 64mb is a good sized partition, and linux swap is good, but compcache and Backing Swap is a lot better...
prince.siraj said:
i would suggest you stick to ext3 because it's more commonly used as of right now... also 64mb is a good sized partition, and linux swap is good, but compcache and Backing Swap is a lot better...
Click to expand...
Click to collapse
Can I have some "made" files to put in my SD card? I have a "normal" 2GB microsd card with 64 mb of swap... I'd be glad for this
I really dont see anything wrong with ext4, Ive had a look in a few rom release threads and most of them have support for it. I use cyanogen mod 99% of the time anyway...
Krishath said:
Can I have some "made" files to put in my SD card? I have a
"normal" 2GB microsd card with 64 mb of swap... I'd be glad for this
Click to expand...
Click to collapse
Are you talking about userinit.sh and user.conf? Just follow the link I posted earlier, took me about 10 minutes to set up.
for swap dont go over 45mb. i honestly can notice the dif. i us my g1 as a test dummy. ext2,3,4 honestly does not make a dif in my eyes. i have tried all. i use linux mint to partition my sd. which by the way is the easiest and sickest way to partition. just had to put that out there for lin users. root root lol!! but ya. over 45mb makes me feel its really trying to find the swap space. try it and give me your opinion. i have partitioned my sd from recovery mkpartfs, windows partition to linux partition editor. ya. trust me. i currently use 40mb swap. that is what really matters. use at ur comfort and day to day usage. fosho!!

Linux-swap Cynanogen?

ok so i made a linux-swap partion on my sd card that is 64mb. Now do i need to activate it somehow? or does cynogen do it for me? i tried to search but couldnt find. also do i need update my radio? it is 2.22.19.26I
You need user.conf and userinit.sh files on your ext partition. There's a guide on how to set that up here.
ok and can i have compcache and linux-swap at the same time? or do they do the same thing? also do i need to make a partion for compcache? and i cant find the htc keyboard in 4.2.3.1, does it come with it?
i thought if you have 4.2.3.1 you didnt have to add the files as it does everything for you? am I missing something.
is compcache and linux swap the same thing? and do we need both?
nahanee20 said:
is compcache and linux swap the same thing? and do we need both?
Click to expand...
Click to collapse
lol, no.
Swap is virtual memory. It uses a seperate partition to act as extra RAM, but it's nowhere near comparable to real RAM.
Compcache compresses what's in the RAM, so there's more space to cram files in. The problem is constantly compressing and decompressing files in RAM puts a heavy strain on the CPU.
so do i need to put the usernit files on or did this rom already do it?
does anyone know how to use the user.config app to do this?
nahanee20 said:
does anyone know how to use the user.config app to do this?
Click to expand...
Click to collapse
You DO NOT have to add any user int files to your sd for swap to work.
Its already rolling if you installed correctly.
go to terminal and use the print command to view your allocated spaces for each ext
Better yet, use the "free" command to see if it is really being used. I am pretty sure Cynanogen does not use a swap partition by default. It needs to be enabled. A easy way to check and setup your swap it to download swapper.
When I type free in the terminal I see 0 for total, used and free swap. I made an ext4 and a 32mb swap partition on my sd card. How do I enable swap on Cyanogen 4.2.5?
beav_35 said:
When I type free in the terminal I see 0 for total, used and free swap. I made an ext4 and a 32mb swap partition on my sd card. How do I enable swap on Cyanogen 4.2.5?
Click to expand...
Click to collapse
search user.conf app on market

Categories

Resources