not clear to me from search what is current state of swap && / || CCache - Android Software/Hacking General [Developers Only]

Can anyone direct me to a guide somewhere?
I'd like to make an ext partition? Or would I? Is Swapper 2 just as fast? Tradoffs? Anyone run into their sd card wearing out yet?

bueler?
The message you have entered is too short. Please lengthen your message to at least 10 characters.

The consensus seem to be "do not use" except as 'last resort', and only needed on phones with 256MB or less of mem.
I wrote this, and I am waiting for a technical review from some experts in this field.
http://forum.xda-developers.com/showthread.php?t=897823

kschang said:
The consensus seem to be "do not use" except as 'last resort', and only needed on phones with 256MB or less of mem.
I wrote this, and I am waiting for a technical review from some experts in this field.
http://forum.xda-developers.com/showthread.php?t=897823
Click to expand...
Click to collapse
I have 256MB ram
At the moment, Compcache is good enough, but I can't help but wonder how much better it could be with swap instead of Compcache.
edit: "For example, If you have a 256MB system (shows as 262MB due to 1024 vs. 1000 KB size difference) and have 130MB of apps and data/cache loaded, then that leaves about 130MB for the system to actually RUN programs. That sounds like a lot, but in reality that is not enough, since the system itself takes 50-80MB, and services will take up another 30-50MB, leaving almost nothing. "
quick review, you don't appear to be differentiating between RAM and Flash? Having more apps installed shouldn't increase RAM usage at all. Unless I gravely misunderstand the Android OS, if I install a new program, it resides in the system flash, not the RAM, until I run it, at which point it gets loaded to RAM. When the system needs memory and no swap or Compcache is in use, it writes the state of the application to the flash and removes it from RAM.
What the swap does is similar to what compcache does-- compresses apps that are currently in RAM, and moves them to the swap space. In the case of Compcache, this is in the RAM. But since you're compressing it, background apps don't take nearly as much RAM, and you get an app switching speedboost because the processor can uncompress the compcache'd program, "move" it to RAM, compress the currently running program in RAM, and "move" it to the compcache. Forgive me if you already said this, I can't read the entire thing at the moment.
As for swap, I'm not sure if the processor compresses before going to the hard swap file, I don't think that it does-- when android starts getting low on RAM, it moves what was in RAM, to the swap on the SD-card. Since it does this when the system is low on RAM, and not when the system runs out of RAM, you never notice it. Reading the app back from the SD card happens almost instantaneously, because the sd cards can be read from at a speed of at least 20MB/s, maybe more. When you're restoring an app to RAM, 20MB/s is plenty.
edit2: I'm sorry but this guide is too vague to be anything more than moderately informative. Comments like:
-"CompCache, or "compressed cache", is handled by the Linux kernel. It takes a portion of your memory, and use it as a cache space, but compressed. By using on-the-fly compression it is able to make your memory appear to be a bit larger than it actually is. However, the result is slower performance.
This is usually NOT tweakble without mod ROM such as Cyanogen Mod. The kernel also must support this feature, and not all do. This also slows your phone. "
-"...swap space by either creating a swap file or a swap partition. This adds a lot of read/write action to your SD card and may substantially decrease its usable life."
-"This really slows your phone."
People wouldn't be doing these things for no reason. Compcache does not "make your memory appear a bit larger", when it at least doubles the amount of usable RAM-- when you allocate 60MB, if you average 75% compression (I usually see between 65% and 80%), do you know how much RAM this effectively nets you? Over at least 60MB extra, usually about 80! So my phone goes from having 256MB ram to having 340 effectively. Having your processor overclocked minimizes any slowdown from the compression/decompression; I haven't noticed any slowdown, and having the "extra" RAM definitely has made my phone more able to multitask.
You basically discourage users from doing ANYTHING like swapping, compcaching, etc to their phone, saying it "slows it down" and "can substantially decrease your SD Card's life". My experience has been otherwise regarding slowing it down, and regarding the SD card, the only part that would actually go bad is the swap partition. If you put that at the end of the drive, when it goes bad, you'll know, and you can just move the partition back 300MB and put your 300MB swap there. We haven't heard of any users' cards going bad from this yet. Also, if you have a class 6+ SD Card, they implement wear leveling on the card, so you don't need to worry about wearing out any individual bits.
Sorry, I'm just not digging it.

rancur3p1c said:
I have 256MB ram
Click to expand...
Click to collapse
Me too, me too...
At the moment, Compcache is good enough, but I can't help but wonder how much better it could be with swap instead of Compcache.
Click to expand...
Click to collapse
So try it. With CM612, I have CompCache AND Swap (through Swapper2 / 128 MB) turned on. It slows down every once in a while but my programs don't crash any more.
edit: "For example, If you have a 256MB system (shows as 262MB due to 1024 vs. 1000 KB size difference) and have 130MB of apps and data/cache loaded, then that leaves about 130MB for the system to actually RUN programs. That sounds like a lot, but in reality that is not enough, since the system itself takes 50-80MB, and services will take up another 30-50MB, leaving almost nothing. "
quick review, you don't appear to be differentiating between RAM and Flash? Having more apps installed shouldn't increase RAM usage at all. Unless I gravely misunderstand the Android OS, if I install a new program, it resides in the system flash, not the RAM, until I run it, at which point it gets loaded to RAM. When the system needs memory and no swap or Compcache is in use, it writes the state of the application to the flash and removes it from RAM.
Click to expand...
Click to collapse
At first I thought the same way you did, until I started looking in "diskusage".
According to diskusage, there is no separate RAM. 256MB is 256MB. App storage is where everything goes, and what's left is used to load services and such. The numbers I added up matches. I have 256 MB phone. 100 is for apps, which leaves about 150-160. System itself takes 50-80 (acore, gapps, phone, system...) then add a few services and you're down to 30-40 MB free to actually run the programs. The numbers seem to match up to what's shown at the bottom of "Manage Services".
I know it's weird, but perusal of Android developers kit doesn't contradict this understanding.
What the swap does is similar to what compcache does-- compresses apps that are currently in RAM, and moves them to the swap space. In the case of Compcache, this is in the RAM. But since you're compressing it, background apps don't take nearly as much RAM, and you get an app switching speedboost because the processor can uncompress the compcache'd program, "move" it to RAM, compress the currently running program in RAM, and "move" it to the compcache. Forgive me if you already said this, I can't read the entire thing at the moment.
As for swap, I'm not sure if the processor compresses before going to the hard swap file, I don't think that it does-- when android starts getting low on RAM, it moves what was in RAM, to the swap on the SD-card. Since it does this when the system is low on RAM, and not when the system runs out of RAM, you never notice it. Reading the app back from the SD card happens almost instantaneously, because the sd cards can be read from at a speed of at least 20MB/s, maybe more. When you're restoring an app to RAM, 20MB/s is plenty.
edit2: I'm sorry but this guide is too vague to be anything more than moderately informative. Comments like:
-"CompCache, or "compressed cache", is handled by the Linux kernel. It takes a portion of your memory, and use it as a cache space, but compressed. By using on-the-fly compression it is able to make your memory appear to be a bit larger than it actually is. However, the result is slower performance.
This is usually NOT tweakble without mod ROM such as Cyanogen Mod. The kernel also must support this feature, and not all do. This also slows your phone. "
-"...swap space by either creating a swap file or a swap partition. This adds a lot of read/write action to your SD card and may substantially decrease its usable life."
-"This really slows your phone."
People wouldn't be doing these things for no reason. Compcache does not "make your memory appear a bit larger", when it at least doubles the amount of usable RAM-- when you allocate 60MB, if you average 75% compression (I usually see between 65% and 80%), do you know how much RAM this effectively nets you? Over at least 60MB extra, usually about 80! So my phone goes from having 256MB ram to having 340 effectively. Having your processor overclocked minimizes any slowdown from the compression/decompression; I haven't noticed any slowdown, and having the "extra" RAM definitely has made my phone more able to multitask.
Click to expand...
Click to collapse
It also seriously depends on your SD card. I've read reports on Phandroid that said class 6 or 8 microSD cards would provide almost lag-free swaps, but that's on a G1 (which is already a slow phone).
You basically discourage users from doing ANYTHING like swapping, compcaching, etc to their phone, saying it "slows it down" and "can substantially decrease your SD Card's life". My experience has been otherwise regarding slowing it down, and regarding the SD card, the only part that would actually go bad is the swap partition. If you put that at the end of the drive, when it goes bad, you'll know, and you can just move the partition back 300MB and put your 300MB swap there. We haven't heard of any users' cards going bad from this yet. Also, if you have a class 6+ SD Card, they implement wear leveling on the card, so you don't need to worry about wearing out any individual bits.
Sorry, I'm just not digging it.
Click to expand...
Click to collapse
Constantly reading and writing the file will cause that area to get much heavier use and eventually cause it to fail the bootup "checking SD card". The only question is how much life is taken away.
I am running my Droid on 24% CompCache AND 128MB Swap right now. Occasional lag but otherwise runs quite well. It's also overclocked to 1.2 GHz with P3Droid's kernel. So I do practice somewhat of what I preach...

so if I have 512MB of ROM, and 256MB of RAM, and I fill up my ROM with programs, how much RAM do I have?
I don't follow how what you said can be.
SD Card writes-- SanDisk guarantees theirs for 100K writes to any given sector...that's good enough for the swap to not be a problem in the near future IMHO.

let's put it this way...
Here's the specs of Moto Droid from Motorola itself (http://developer.motorola.com/products/droid/)
RAM 256 MB
FLASH ROM 512 MB
USER STORAGE AVAILABLE (MAX) 256 MB
So the REST of the ROM clearly is to hold the Android OS itself. The actual programs you can load for running? 256MB. That's app storage.
I've always wondered if there's a way to read the actual ROM contents and enumerate that... But that's for another topic.

Found this useful post: boot process of Android OS
http://www.androidenea.com/2009/06/android-boot-process-from-power-on.html
Furthermore, I noticed that the "built-in" apps (i.e. bloatware) are actually just stuff left in the "system" dir which can only be accessed with root permission. So they are NOT store in "ROM" per se, but more like "part of boot rom".
I have to find explanation on how an app is loaded, but that helps...

Aha, so that's the term they used... Application Lifecycle.
http://www.youtube.com/watch?v=ITfRuRkf2TM
Okay, I take back what I said. Apps are loaded into RAM, but HOW things are allocated wasn't that clear.
From what I understand, apps, when they are killed by system, some exit gracefully by writing their instance "state" (data and cache) to app storage. Some just exits.
Browser will write the URL, for example. When the browser is "resumed", the process is loaded, then the instance loads back the URL and it's as if nothing happened.
I'll have to revise the paper, AND I haven't figured out what to say about swap and compcache yet.

Made some corrections.
On 256MB machine, 30MB is used by deep system buffers (not part of OS), another 32 for OS cache, so about 190 or so is available the OS itself to load apps and services, and just the default gapps, system, phone, and so on is about 60MB. So a fresh clean phone should ahve no more than 120-130 MB free. If you load a couple apps with autostart services, it'll quickly drop below 50MB.
http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android

Another piece of the puzzle... The numbers at the bottom of "Manage Services" is as explained below:
(quoting from http://android-developers.blogspot.com/2010/02/service-api-changes-starting-with.html )
"Finally, along the bottom of the screen are some obscure numbers. If you know how to interpret them, this gives you a lot of information on the memory status of your device:
* Avail: 38MB+114MB in 25 says that the device has 38MB of completely free (or likely used for unrequired caches) memory, and has another 114MB of available memory in 25 background processes it can kill at any time.
* Other: 32MB in 3 says that the device has 32MB of unavailable memory in 3 unkillable processes (that is, processes that are currently considered to be foreground and must be kept running)"
The order is reversed in Android OS 2.2. Mine says
Other: 75MB in 5 Avail: 18MB + 20 MB in 3
Which should mean 75MB in 5 unterminable tasks, 18 MB free (or can be freed easily), plus another 20 MB used by 3 processes that can be killed to free up.
ProCrank says...
39911K System_server
15756K acore
12982K swiftkey
10136K DIY Screensaver (lock screen)
9392K Phone (system)
9093K ATKfroyo
6834K Terminal
3984K JuiceDefender
3785K Screebl
3482K system MMS
3329 SeePU
3244K Bluetooth
3199K SetCPU
1979K Zygote (which is Dalvik init)
1425K Mediaserver
and the rest is native system code well under 1MB in size.
If you add System_server, Phone, Zygote, Acore, and foreground app (terminal and procrank) you get about 75MB. It would be nice if that screen TELLS you which program it considers to be unterminable, but, oh well...

Related

[CompCache] Setting compcache to full RAM size

I've always run compcache on my ROMs when possible and I recently had the idea that setting the full amount of RAM to compcache could be an interesting test. The theory being that it may be slightly slower overall to have ramzswap compressing pages, but minfree would have heaps of memory to play with and apps would never quit, so multitasking would be faster as no apps are writing out to /data and then having to relaunch when I switch to them again.
I've set compcache with the init script like so
Code:
insmod /system/lib/compcache/ramzswap.ko;
rzscontrol /dev/block/ramzswap0 -i -d 98304;
busybox swapon /dev/block/ramzswap0;
And Linux reports the swap is working
Code:
# free
total used free shared buffers
Mem: 107332 105972 1360 0 8
Swap: 98296 48940 49356
Total: 205628 154912 50716
But no matter what I do, even if I launch a heap of apps, I can never get swap usage above the ~48Mb RAM seen here.
Furthermore, apps like Auto Killer and Free Memory only report I have 102Mb RAM total.
What's going on here? Why does Android think it only has 100Mb when free is reporting near on 200Mb total? Why does compcache only fill up halfway and no more? Does this mean that ~48Mb RAM is the "sweet spot" for compcache and any more is pointless?
The phone does feel faster when switching between apps but I could just be imagining it. Out of interest this is a 32B Magic running Dwang 1.17.1, which is basically just Donut AOSP with a faster framework and kernel.
Any ideas/help/suggestions would be appreciated?
Swap is never, ever, regarded by the system as real memory, hence why the system won't report it, since you really only have ~100 mb physical ram.
As to why you're only using 48, I believe that 48 is 1/2 96, so it probably means pages are being compressed 2:1, so the full memory is being compressed and dumped into RAM, and it only occupies 48 MB, leaving you 48 free for other processes.
Again, remember comcapche is swap, not real memory.
jubeh said:
Swap is never, ever, regarded by the system as real memory, hence why the system won't report it, since you really only have ~100 mb physical ram.
As to why you're only using 48, I believe that 48 is 1/2 96, so it probably means pages are being compressed 2:1, so the full memory is being compressed and dumped into RAM, and it only occupies 48 MB, leaving you 48 free for other processes.
Again, remember comcapche is swap, not real memory.
Click to expand...
Click to collapse
I don't think that that analysis is quite right....
First off, you MUST maintain SOME amount of real memory available... otherwise it'll crash in a spectacular way. I believe that the linux kernel itself may have a safety feature that maintains a certain minimum amount of physical ram available. There ARE certain things that the linux kernel will not be willing to swap, such as ITSELF.
Just imagine what would happen if the kernel swapped itself..... any attempt to do this wouldn't end well. Especially if it tried to swap its ENTIRE self since the kernel MUST be in memory in order for it to run.
There is also the swappiness setting... it controls the system's tendency to swap.
And finally, there is the possibility that you may simply not be starting enough processes to consume the full memory!
So imagine this; you have your compcache set for a certain size. It grows to that size and then finally, the kernel says "screw you, you can't have any more memory!" blows an error back to compcache, which complains back to the kernel "sorry, swap is screwed." Yep.... the kernel tells compcache which tells the kernel rather than the kernel just knowing.
You definitely don't want this happening.
Note: I can forsee some serious stability problems that this could result in related to the low memory process killer. Specifically, your compcache grows to its maximum allowed size, you start an application, the low memory process killer figures that you've got plenty of memory available, doesn't kill anything off, tries to start some application, crashes spectacularly when the kernel complains back that it doesn't have any memory. I don't know if this would happen with a stock low memory process killer, but definitely would with the swap hacks added....
lbcoder said:
Note: I can forsee some serious stability problems that this could result in related to the low memory process killer. Specifically, your compcache grows to its maximum allowed size, you start an application, the low memory process killer figures that you've got plenty of memory available, doesn't kill anything off, tries to start some application, crashes spectacularly when the kernel complains back that it doesn't have any memory. I don't know if this would happen with a stock low memory process killer, but definitely would with the swap hacks added....
Click to expand...
Click to collapse
92 MB of compcache doesn't really need 92MB of compcache... that's the point of being compcache.
Compcache file in RAM grows when cache gets stuffed inside compcache.
Setting a low swappiness will cause compcache to just swap what's needed.
And even with full compcache, in the end you end up having around 140 mb (or so) free ram. 92mb of compcache that takes like 50mb and 42 extra mb of normal ram.
I think this idea is great (I was just too lazy to try yet...). Instead of dalvik vm having to free up memory it can stuff some more mb in compcache. should be faster.
I didn't really think my post through... but I hope some of you understood some of the things I wanted to communicate xD
domenukk said:
92 MB of compcache doesn't really need 92MB of compcache... that's the point of being compcache.
Compcache file in RAM grows when cache gets stuffed inside compcache.
Setting a low swappiness will cause compcache to just swap what's needed.
And even with full compcache, in the end you end up having around 140 mb (or so) free ram. 92mb of compcache that takes like 50mb and 42 extra mb of normal ram.
I think this idea is great (I was just too lazy to try yet...). Instead of dalvik vm having to free up memory it can stuff some more mb in compcache. should be faster.
I didn't really think my post through... but I hope some of you understood some of the things I wanted to communicate xD
Click to expand...
Click to collapse
Interesting in theory, but if you actually read what I said, you would note that this is entirely IMPOSSIBLE and would crash spectacularly if not for and in some cases in SPITE of certain safety features built into the kernel.
Note: If you have 70 MB worth of data that CAN'T be swapped, that leaves 20 MB ***PEAK*** available to compcache.
It is neither fair nor sensible to think of all memory as being equal. Running processes ***MUST*** have REAL MEMORY.
A little off-topic, but this discussion (the possibility of REAL "compressed" memory) sparked a thought/question:
Would/could KSM* bring any benefit to Android? (Not sure if the KSM module can even compile/work on ARM)
I know KSM is normally used for detecting and sharing duplicate pages among KVM guests, but I wonder how many pages in a typical running Android installation are duplicated, and thus candidates for sharing/de-duplication.
*I can't posts links yet, so those that don't know what KSM is, will just have to google for it.
lbcoder said:
There ARE certain things that the linux kernel will not be willing to swap, such as ITSELF.
Click to expand...
Click to collapse
I was under the impression the kernel keeps itself in RAM and then reports free memory to the rest of the OS. This is why the phone physically has 192Mb RAM, but only reports 96Mb free (or 107Mb with RAM hack). Perhaps my understanding of Linux/Android memory reporting is not correct?
lbcoder said:
It is neither fair nor sensible to think of all memory as being equal. Running processes ***MUST*** have REAL MEMORY.
Click to expand...
Click to collapse
I think this is likely what is happening. Home, Phone, System and other processes with a low oom are refusing to swap out as they are still running. If the compcache allocation in RAM is dynamic as domenukk says, then those processes are occupying enough RAM that the ramzswap allocation can only grow to ~48Mb as I am seeing. I didn't think of this.
Nor have I tweaked swappiness. It's currently set to 60 (default) so I'd assume it's not too fussy with paging out. I will try playing with this at 10 and 100 to see if I can force anything more into swap or if it's less willing to swap.
brainbone said:
*I can't posts links yet, so those that don't know what KSM is, will just have to google for it.
Click to expand...
Click to collapse
I do not know either, but here are some links people may wish to look at
http://fedoraproject.org/wiki/Features/KSM
http://lwn.net/Articles/306704/
http://lwn.net/Articles/330589/
http://www.linux-kvm.com/content/using-ksm-kernel-samepage-merging-kvm
Ok I am not at all experienced in this area but this is just a suggestion. You say that you can only get 48mb of swap to be compressed at a time. If those 48mb were uncompressed, then that would occupy the 98mb you alloted to it. If you set the cc at say 128mb, then in (my) theory up to 64mb of it the actual ram would be used. I don't know how much sense I'm making but not sure exactly how to explain it. If you don't get it I'll try explaining my logic a little more in depth.
mejorguille said:
If you set the cc at say 128mb, then in (my) theory up to 64mb of it the actual ram would be used.
Click to expand...
Click to collapse
It appears you are right. Even with swappiness set to 100 and opening every app on my phone I'm not able to fill more than half of 128Mb compcache before minfree stats gracefully closing processes:
Code:
/opt/android-sdk-linux_86/tools$ ./adb shell free
total used free shared buffers
Mem: 107332 105956 1376 0 32
Swap: 131064 65520 65544
Total: 238396 171476 66920
Super Jamie said:
It appears you are right. Even with swappiness set to 100 and opening every app on my phone I'm not able to fill more than half of 128Mb compcache before minfree stats gracefully closing processes:
Code:
/opt/android-sdk-linux_86/tools$ ./adb shell free
total used free shared buffers
Mem: 107332 105956 1376 0 32
Swap: 131064 65520 65544
Total: 238396 171476 66920
Click to expand...
Click to collapse
I rock=p
So what's your performance like, compared to say 32mb cc or no cc at all?
It's different but I like it.
There is sometimes a slight (<2 second) pause when launching a new app (I assume this is compcache compressing old pages to swap to make way for the new app) however once the app is up and running, it almost never "exits" so switching between previously-launched apps is noticeably faster than without compcache. I run HelixLauncher Donut and it's never closed and re-launched while I've been trying this, however it did sometimes with 32Mb cc and quite often without cc at all.
I had 5 day uptime last week with 96Mb compcache (rebooted whilst testing another app for a friend) so I don't think stability is an issue. The CM wiki indicates performance with cc is better upon boot then gradually declines, even if that is the case, rebooting my phone once a week is no big issue.
Unless I run into any major issues, I'll be keeping my phone with large compcache
Super Jamie said:
I was under the impression the kernel keeps itself in RAM and then reports free memory to the rest of the OS. This is why the phone physically has 192Mb RAM, but only reports 96Mb free (or 107Mb with RAM hack). Perhaps my understanding of Linux/Android memory reporting is not correct?
I think this is likely what is happening. Home, Phone, System and other processes with a low oom are refusing to swap out as they are still running. If the compcache allocation in RAM is dynamic as domenukk says, then those processes are occupying enough RAM that the ramzswap allocation can only grow to ~48Mb as I am seeing. I didn't think of this.
Nor have I tweaked swappiness. It's currently set to 60 (default) so I'd assume it's not too fussy with paging out. I will try playing with this at 10 and 100 to see if I can force anything more into swap or if it's less willing to swap.
I do not know either, but here are some links people may wish to look at
http://fedoraproject.org/wiki/Features/KSM
http://lwn.net/Articles/306704/
http://lwn.net/Articles/330589/
http://www.linux-kvm.com/content/using-ksm-kernel-samepage-merging-kvm
Click to expand...
Click to collapse
ksm sound cool. As every app runs inside dalvik vm. Not sure though... somebody should ask cyanogen
I am happy thatlarge compcache works out so well for you.
BTW doesn't cyanogenmod 5 count the whole swap as real memory since test4 or so?
Oh and overclocking ondemand to as high as possible will speed up app opening and switching a lot while on compcache
domenukk said:
doesn't cyanogenmod 5 count the whole swap as real memory since test4 or so?
Click to expand...
Click to collapse
It's counted as available "swap" memory, but not "real" ram. Pages stored in "real" ram (memory that the cpu can directly execute code in) still need to be freed up (moved to swap) before previously swapped pages can be moved back in to "real" memory to be executed.
domenukk said:
ksm sound cool.
Click to expand...
Click to collapse
The beauty of KSM is that it does no "swapping". It simply combines 4KB pages that are identical -- so instead of two identical 4KB pages using 8KB of ram, they only take 4KB. The code is executed in place.
KSM would, however, still require swap. If at any time a virtual shared 4KB page is written to, it needs to be copied to a free page to avoid corrupting the virtual page it was a duplicate of before the write. Swap is needed to ensure that there will always be enough available free pages when this happens.
domenukk said:
As every app runs inside dalvik vm.
Click to expand...
Click to collapse
KSM is not dependent on a VM, but the existence of VMs (java or otherwise) increases the likelihood of duplicate pages.
domenukk said:
Not sure though... somebody should ask cyanogen
Click to expand...
Click to collapse
I'd certainly be interested in cyanogen's thoughts on this, but I'm sure there are others that would be able to chime in as well.
Relevant excerpt from kernel.org/doc/ols/2009/ols2009-pages-19-28.pdf
KSM and embedded
KSM is suitable to be run on embedded systems too; the important thing is not to register in KSM regions that won’t likely have equal pages. For each virtual page scanned, KSM has to allocate some rmap_item and tree_item, so while these allocations are fairly small, they can be noticeable if lots of virtual areas are scanned for no good.
Furthermore, these KSM internal rmap/tree data structures are not allocated in high memory. To avoid early out of memory conditions, it is especially important to limit the amount of lowmem allocated on highmem 32bit systems that might have more than 4GB of memory, but these shouldn’t fit in the embedded category in the first place.
Click to expand...
Click to collapse
Super Jamie said:
I was under the impression the kernel keeps itself in RAM and then reports free memory to the rest of the OS. This is why the phone physically has 192Mb RAM, but only reports 96Mb free (or 107Mb with RAM hack). Perhaps my understanding of Linux/Android memory reporting is not correct?
Click to expand...
Click to collapse
Memory reporting is a tricky thing.
But in general, when RAM is allocated to HARDWARE, it is NOT REPORTED.
The chunk of the 192 that is not reported is assigned PRIMARILY to the RADIO. Another chunk is assigned to the GPU. Still more is assigned to the AUDIO HARDWARE.
The part used by the kernel itself IS reported. The most trivial empirical evidence to prove this to you is that when you change KERNELS, it doesn't affect the total system memory, despite your KNOWING that different kernels use different amounts of RAM.
Another bit of empirical proof is that activating COMPCACHE does not reduce the total physical ram reported. And yes, COMPCACHE is part of the kernel...
Now here's another concept of crash and burn: IF everything in memory could be cached in compcache, then what would stop compcache from caching compcache in a horrible infinite memory sucking loop? That would be very very bad, LOL.
I think this is likely what is happening. Home, Phone, System and other processes with a low oom are refusing to swap out as they are still running. If the compcache allocation in RAM is dynamic as domenukk says, then those processes are occupying enough RAM that the ramzswap allocation can only grow to ~48Mb as I am seeing. I didn't think of this.
Click to expand...
Click to collapse
NOW you're getting the idea! Running processes, kernel, etc., all need physical RAM (though actually those processes you mention most definitely CAN be swapped...), and therefore you CAN'T make the ENTIRE RAM into compcache!
Nor have I tweaked swappiness. It's currently set to 60 (default) so I'd assume it's not too fussy with paging out. I will try playing with this at 10 and 100 to see if I can force anything more into swap or if it's less willing to swap.
Click to expand...
Click to collapse
Just beware of possible crash-and-burn
Super Jamie said:
It appears you are right. Even with swappiness set to 100 and opening every app on my phone I'm not able to fill more than half of 128Mb compcache before minfree stats gracefully closing processes:
Code:
/opt/android-sdk-linux_86/tools$ ./adb shell free
total used free shared buffers
Mem: 107332 105956 1376 0 32
Swap: 131064 65520 65544
Total: 238396 171476 66920
Click to expand...
Click to collapse
That doesn't actually follow from what you've posted here.
What follows is that 105956-(65520/2)=73196 of what occupies your memory can't be swapped (kernel, running processes, etc.).
lbcoder said:
What follows is that 105956-(65520/2)=73196 of what occupies your memory can't be swapped (kernel, running processes, etc.).
Click to expand...
Click to collapse
Do you know why swap constantly "settles" at almost exactly half usage regardless of what size compcache I set?
For example, I set 64Mb compcache yesterday and rebooted. Just using my phone normally (browser, genie widget, music) I have this:
Code:
total used free shared buffers
Swap: 63992 32096 31896
Does this mean I am effectively reducing the amount of RAM the phone has for the kernel, "foreground app", "visible app" and "secondary servers" (to use the minfree terms), whilst at the same time allowing more "hidden app" and lower processes to swap out instead of terminating gracefully?
This disturbs me
-------------------------------------
Sent via the XDA Tapatalk App
brainbone said:
I'd certainly be interested in cyanogen's thoughts on this, but I'm sure there are others that would be able to chime in as well.
Click to expand...
Click to collapse
He doesn't know much about it, yet. But he seems inerested.
Attached a short conversation over #twitter
# Dominik domenuk
@cyanogen Is ksm any good 2 save RAM? probably not - you would have already done it http://lwn.net/Articles/329123/
# Steve Kondik cyanogen
@domenuk I don't know too much about it, I think its meant for sharing between distinct virtual machines
@domenuk it could have a lot of potential though
# Dominik domenuk
@cyanogen basically yes. But he states its also for normal apps. I have no idea to what extend android apps have similar memory, though...
# Steve Kondik cyanogen
@domenuk a lot, Android is all about IPC and shared memory. I wouldn't be surprised if the Dalvik people are thinking about it.
Click to expand...
Click to collapse
Here is a way to make Android use more than 50 percent of a swap partition. I am not sure how it will act with compcache... Should be the same... Run the following commands from a terminal or add them following to your userinit.sh file:
Code:
su
echo 80 > /proc/sys/vm/swappiness
echo 150 > /proc/sys/vm/vfs_cache_pressure
!!WARNING!! - Messing with VM settings can cause data loss and system instability... Not liable for damages...
Using the above the "free" output is:
Code:
total used free shared buffers
Mem: 97708 95168 2540 0 356
Swap: 125296 88756 36540
Total: 223004 183924 39080
While we are at it... If anyone is willing... they can try this as well:
echo 1 > /proc/sys/vm/oom_kill_allocating_task
Reference : Article to Linux Insight
Been having pretty good results with it...
Here is a link to the rest of the vm settings...
Linux Insight article listing vm settings
L8r

[Q] Need technical review of "Guide to Android OS Memory Management"

Otherwise known as "Why Newer Android Phones Don't Need Task Killers".
This is straight ASCII cut-and-paste from my Evernote page, so any spelling and grammar mistakes are mine. I have looked over various apps such as AutoKiller, Advanced Task Killer, various threads on memory management in Android, even a few bits of Android source code. I know about compcache, minfree, swap, kernel, and more.
This is aimed at an Android owner who knows the basics, but is trying to optimize their device. They may have experimented with ROMs and kernels based on recommendations, but don't know about serious internal tweaking.
I realize what I wrote will probably have the techies screaming "no, no, that's not quite right"... That's why I want a tech review. If I had committed any serious misunderstandings, please let me know. If you have more references, please list them. Would prefer a bit more detailed comments than "sucks" or "great".
-------
Memory Management in Android: the myths and the facts
Introduction
The Android OS, now at V2.3 "Gingerbread", is widely misunderstood, due to lack of hardware specifications and the open nature of system, has created a wide set of myths regarding how the memory is managed, and how one can best achieve good performance on an Android device.
This article will attempt to explain just how Android OS manages memory, dispel some myths regarding Android memory, and show you some techniques that will help you keep your system running smoothly while achieving good performance.
However, first, here's some technical stuff about Android memory and applications. Trust me, all this is necessary to understand how the whole thing works.
Android OS Memory Management Basics
Android OS, as of V2.2 (and 2.3) have two general types of memory: internal storage (sometimes known as application stroage), and SD card (which may be flash memory that works like SD card, but not physical SD card, such as in the Nexus S)
All apps (in the form of APKs) are loaded into internal storage. Each program can also request additional space as "data" and/or "cache".
All apps (in the form of APKs) are loaded into "app storage" part of the "ROM" (actually flash RAM). Part of the ROM is the boot ROM which loads the system. The other half of the ROM is "app storage". For example, in Motorola Droid, 256MB is RAM, and 512MB is ROM. Out of 512MB ROM, 256MB is Android System itself (actually a bit less), and the rest is "app storage", to max of 256MB.
With Android 2.2 and "Move2SD", a portion of the APK can be moved onto the "SD card", but main portion must remain in internal app storage. The size of the main portion that stays would depend on the app. Some apps cannot be moved or will not function if moved. "Protected" apps cannot be moved. Apps that primarily consist of a service and a widget may not work if moved. add Services or widgets needed for startup should not be moved.
For example, If you have a 256MB system (shows as 262MB due to 1024 vs. 1000 KB size difference) and have 130MB of apps and data/cache loaded, then that leaves about 130MB for the system to actually RUN programs. That sounds like a lot, but in reality that is not enough, since the system itself takes 50-80MB, and services will take up another 30-50MB, leaving almost nothing.
addedIn a 256MB RAM phone such as my Moto Droid, AutoKiller shows...
acore : 4.55MB (system)
dialer: 8.95MB (system)
system: 20.38MB (system)
autokiller:5.68MB
messaging: 3.41MB (system)
Swiftkey: 6.59MB
JuiceDefender 4.14MB
Calendar Storage 4.1 MB (system)
acore: 7.7MB (different pid) (system)
smart taskbar 3.81 MB
seePU 3.44MB
Screebl 4.38MB
SetCPU: 3.83MB
ATK Froyo 3.01MB
gapps: 7.79MB (system)
and 2 more at 4.66MB and 3.56MB
That adds up to... 99.88, or 100 MB.
But that is supposed to leave 156MB, right? Wrong. The system itself takes about 100 MB by itself, in addition to loaded programs, according to this thread about T-Mobile G1 (which has 192 MB of RAM, and has about 96000 KB after booting)
UPDATE: I found an article that explains how to read "MEMINFO". You can get MEMINFO app, or if you have SetCPU the overclocking widget it shows MEMINFO as well. Mine says roughly:
MemTotal: 231740 KB, or 226MB
MemFree: 3376
Buffers 272
Cache: 34960
SwapCache: 0
So the system (before OS kernel) uses about 30MB leaving about 226 MB
Cache itself used another 35 MB. , leaving about 189 MB
Minus 100 MB of auto-loaded apps, and you get... 89 MB.
If you run any programs that need more than that, programs and services will be killed to make room.
(see Redhat's explanation on what meminfo is supposed to mean)
SIDEBAR: native vs. Dalvik
There are two types of Android programs... "Native" programs, and VM programs.
Native programs are written for the specific CPU in the machine. While this gives better performance, this is much harder to achieve, so most people write program for the VM, or "Virtual Machine".
A "virtual machine" is basically a CPU emulator. You feed it a program, and it will run this program, as if it's a real CPU. The good thing about using a VM is it doesn't matter what the actual physical CPU the device uses. You write the program once, and never have to worry about converting it to other CPUs.
Android's VM is called Dalvik, and it is similar to Java's virtual machine. (In fact, Sun/Oracle sued Google for violating Java copyrights on JVM)
Different pieces of a single app
Most apps have either just an activity, or activity along with a service.
"Activity" is basically the user interface that takes your inputs and displays something back. Foreground app would be an activity.
"Service" is a background program that updates something. Common services includes input, widget updates, mail notification, and so on. Other services include Bluetooth, network updates, and so on.
(Actually there are two more types: broadcast receiver, and content provider, but those are not that pertinent to our discussion)
An app can use a widget, and the widget can use a lot of memory, usually several MB at once. You can see the different services and how much memory they are taking under Settings / Applications / Manage Services
How Services Use Memory
As explained above, Android OS have to run programs from within the limited space available, which, on older phones, isn't much. From within that much memory, it needs system work space to load all the services (you probably have a dozen loaded, taking up at least 30 MB) System itself uses about 60-70 MB (acore, phone, gapps, messaging, etc.) That's 100 MB used. That doesn't leave much memory for anything else, if you have 100 MB of apps loaded. (256-100-100=56) 100MB for system itself, about 100MB used for apps and services, and you got almost nothing left.
If you look at the services screen, at the bottom, there's a bar: red, yellow, and green. There is a number in the red section and some in green. Your services adds up to the number in the green section. The yellow portion is some memory that can be freed. The red stuff are system stuff and can't be moved.
What Happens When System Runs Out of Memory
When the system needs to load programs, but don't see enough available, it will start killing programs and services (to the system, they are all considered "process") from memory based on the following priority:
Empty App: the app is in standby, not being used, but is still in memory. These can be killed without any effect.
Content Provider: process that provides content to the foreground, such as "contacts content provider", "calendar content provider", and so on. Various "storage" are also content providers. Those can be restarted when needed.
Hidden Application: apps not visible, but still running in the background. These are not exactly running, so killing them should have no serious consequences.
Secondary server: services that stay in background and apps such as Launcher (or other home replacements). Most services go here, like music player, clock updater, background sync, and so on, that's not built into the OS. If these are killed there may be some problems, such as the playback is interrupted, background sync stops, widget no longer updates, and so on.
Visible app: the app is running and visible, but due to multi-tasking or such is not currently "on top". Any program with a display in the notification area is considered "visible". Android OS will not kill these programs unless absolutely necessary, but it can happen.
Foreground app: you see this app on screen, currently running, but also includes the system itself and "phone". These are never killed. In any case, system and phone have much higher priority than any app to make sure those are never killed.
Each category above has a certain number associated with it, sometimes known as a "minfree" value (in either "pages" or megabytes, depending on the app). When Android OS free memory drops below the minfree value for that category, apps in that category are killed. The killing starts Empty App group as that has the highest number. if that's not enough, it then starts killing apps in the Content Provider Group, and it keeps going until it has finally freed up enough memory to load the app and all related processes (such as services).
NOTE: Having a constant "notification" in the notification area makes the program "visible app" instead of "hidden app", thus making it less likely to be killed by the system to make room for other apps.
A lot of problems with Android device occur when the system tries to make room by killing "secondary server" processes that are needed. Playback of audio (music or podcast) stopped, download stopped, location services stopped... etc. This especially happens on phones with little RAM. First Android phone, T-Mobile G1 / HTC Magic, has 192MB of RAM. Moto Droid have 256MB of RAM. Second generation of Android phones, like HTC Wildfire, got 384MB of RAM. Recent phones, like Droid X, Galaxy S, and so on got 512MB.
NOTE: Some apps, like web browser, can exit but still save the URL you were browsing. So when the process reloads, it is almost as if it was never unloaded. Unfortunately not all apps can do that.
So what is the solution?
There are two approaches to the problem: make more memory available, or pre-empt the auto-kill by killing apps yourself.
Making More Memory Available
There are four ways to make more memory available short of exchanging the phone for a more powerful one.
1) Free up more app storage / internal storage
Either uninstall the apps altogether, or move2sd as much as possible. Keep in mind move2SD may not work for all apps, and amount that can be freed varies greatly. Uninstall an app is best, as it both frees up the space itself takes, and if it loads a service, that service is loaded either, saving even more space.
While it's true that the app that wasn't run won't take up any space, every widget is served by a service, and a small app can load a HUGE service by calling existing libraries and declare a large buffer for downloads. And just because you don't actually use the app doesn't mean the system will not load it. The only way to make sure the app will NOT be loaded is to uninstall it (or if you have Titanium Backup premium, you can "freeze" the app)
2) VMHeap
VMHeap adjusts the the amount of memory that can be dedicated to the Dalvik Virtual Machine (VM). In general this should not be touched, and does not really make more memory available. It is available only for experimentation purposes.
This usually is NOT tweakable without mod ROM such as Cyanogen Mod. And benefits are unproven so far. Don't change anything yet.
3) CompCache
CompCache, or "compressed cache", is handled by the Linux kernel. It takes a portion of your memory, and use it as a cache space, but compressed. By using on-the-fly compression it is able to make your memory appear to be a bit larger than it actually is. However, the result is slower performance.
This is usually NOT tweakble without mod ROM such as Cyanogen Mod. The kernel also must support this feature, and not all do. This also slows your phone.
4) Swap file or partition
Linux kernel allows the OS to use the SD card as swap space by either creating a swap file or a swap partition. This adds a lot of read/write action to your SD card and may substantially decrease its usable life. However, it is a reliable way to "add" a lot of memory to your system.
Root access is required to swap the kernel, and the kernel must support this feature as well. Not all do. This really slows your phone. Beware.
Pre-emptive Killing of Tasks
The other way to avoid auto-kill is to kill the processes yourself via an app, so the auto-kill is not triggered. This is why apps like Advanced Task Killer and all the other "task killers" are created.
Basically, the task killers automate the task of killing apps, so it will free up memory thus auto-kill is NOT triggered. And because Task Killers have ignore lists, you can add your specific app to be ignored, and hopefully it will still run.
The best known one is ATK (advanced task killer) by ReChild, but there are plenty of others on the market. They usually have tweakable settings, like killing apps every time the screen is turned off (eeks!) or just at timed intervals (every 30 minutes), and so on.
On a phone with 512MB (or more) of memory, there should be no need for task killers, as the phone should not run out of memory. On phones with 256MB or less of memory, ATK may be necessary to keep the phone "free" for other apps.
Recommended Actions
If you have one of the older phones with little memory (256MB or less), load only the bare minimum of apps you need. uninstall the rest. You need to minimize your memory usage as much as possible to leave as much space for the apps. Keep 100-150MB available for the system is best. After system and services loaded, there should be at least 50MB left to load other programs and such.
You can use archivers like Titanium Backup or AppMonster to archive the apps to SDcard, and only reactivate them when you need them. Or you can delete them altogether, only redownload them from the Market when you need them. This will even work for purchased apps.
You can also purchase Titanium Backup which allow you to "freeze" apps, which makes leaves them in memory but NOT loaded. You can also uninstall built-in apps that you don't use, such as Amazon MP3, saving even more space.
If that is not enough. you can try using CompCache and/or Swap. However, those are not exactly recommended, and thus are only methods of last resort if you can't kill enough apps to matter. Try 18% compcache or even 26% compcache. If that doesn't help, try 128MB swap, or even 256MB swap if that still doesn't help.
For phones with 384MB or more RAM, you should not have to be so stingy, but no need to overload either. With extra 128MB -384MB you can load extra 50-100MB of apps and a few more services. The idea is still to keep 100-200MB available (depending on the phone). You do not need task killers and all that.
I was looking on the explanation for OOM priorities, and there it is. Thanks. I'm wondering why there are no replies to this thread. Oh wait, it's a question.
thanks for the most awaiting tutorial abt RAM.n yes i was wonderng y this thread hasnt got applause...

[Q] 768 RAM and Apps?

Does the 768 RAM on the MyTouch 4G allow installing more apps or is the memory reserved for apps/data the same as for a 512 device?
Thanks.
I think you are confusing the memory used for storage (1gb available internally) with the memory used for running apps (768mb).
You have 768mb of system memory (for running apps). 1gb of internal memory for apps/storage along with 8gb on the removable SD card.
What are you talking about man?
RAM = random access memory.
ROM = Read only memory.
Ram is what used to allocate the programs/app that is already installed on ROM, so it can run on the phone. In simple ROM is where you install it and to run the program when you load it then its allocated in RAM, I hope it make sense to you.
I've currently got an Acer Liquid E which has 512 MB RAM but I need an AWS phone now.
The phone has 512 MB RAM but only part of that is allocated for storing apps and their data. I believe after a clean wipe only around 70 MB is available for apps (I could be wrong about that number). I believe the rest of the RAM is reserved for the OS and various caches. Even though many apps can be moved to the SD card, there always remains part of the app taking up memory in RAM so if you install too many apps you'll eventually run out of space and things get ugly.
So my question is whether the larger amount of RAM (an extra 256MB) is (at least partially) available for a larger amount of app space, or whether the amount of space available for apps is the same as on a 512MB device, with the additional 256MB being used only by the OS...
I'm sure I've got some of the details wrong, but still the basic question: can the MyTouch 4G have more apps installed before going wonky than say a Samsung Vibrant?
Thanks!
No wonder you got confused I just looked up the spec for Acer Liquid E. It has 512MB ram and rom. Now you are saying that you installed alot of apps and its becoming sluggish? In that case disable some of the service and close some apps you don't use. Normally you won't have 512MB or the actual ram in any device as OS itself and other things use some memory some even used for accelerated graphic depending on the phone.
What you should look for is first remove all the boltware and run the phone barebone without running many things then you can see how much actual memory is available to you to run other service/apps. Also you can save the app as in installing in SD but that has nothing to do with the RAM which is just saving in SD and not in NAND. But when you run the app it will still have to be allocated on RAM thus enabling you to use it.
On my system the RAM appears to be partitioned into /system, /data, and /cache. It seems the /data partition is what's available for use by apps. When this gets low (around 20 MB or so) performance is seriously affected and some apps don't even work right. On my system there is 200MB available for data. I assume it's similar on other devices with 512 MB RAM.
One way to check is install the free app "App 2 SD Free" and on the "On phone" tab at the bottom it will give you total and available memory. (I'm sure there are lots of other ways to check, but it's one app I've got installed that has this info. Here's a link: whoop's it won't let me post a link...)
Anyway, what I'm trying to find out is if there's more available memory on the MyTouch 4G. If someone with this phone could run this app let me know what the "total" memory "On Phone" is I'd appreciate it!
Thanks!
tmagritte said:
On my system the RAM appears to be partitioned into /system, /data, and /cache. It seems the /data partition is what's available for use by apps. When this gets low (around 20 MB or so) performance is seriously affected and some apps don't even work right. On my system there is 200MB available for data. I assume it's similar on other devices with 512 MB RAM.
One way to check is install the free app "App 2 SD Free" and on the "On phone" tab at the bottom it will give you total and available memory. (I'm sure there are lots of other ways to check, but it's one app I've got installed that has this info. Here's a link: whoop's it won't let me post a link...)
Anyway, what I'm trying to find out is if there's more available memory on the MyTouch 4G. If someone with this phone could run this app let me know what the "total" memory "On Phone" is I'd appreciate it!
Thanks!
Click to expand...
Click to collapse
You have your definitions messed up:
You are talking about ROM (read only memory) which is like hard drive in your computer. MT4G has 2gb of memory with about 1gb available to end user. SD card can be used to supplement ROM, if app developers enable it (most do) so you have the potential to have up to 17gb of storage space for apps.
RAM (random access memory) is what used to actually run those apps (i.e ability to multitask) and so far this phone has more RAM then any other phone on the market (768MB).
In short: you have roughly 5 times more available memory for apps then on old phone and that does not even include SD card.
Does that help?
Ignore this post: read the one below.
OK, I think I've been confused because the Acer has 512 MB RAM and ROM. So as I understand it now, there's some amount of ROM on the phone that is available to install apps and separate from this is the RAM used to run the apps. I'm guessing the amount of RAM taken up by apps depends on the apps and services currently running, not on the total installed in the ROM?
So having more ROM will let you install more apps but having more RAM will be better for multitasking and speed since more apps can reside in RAM before being swapped out?
From what I've picked up on this thread and Google:
MyTouch 4G: 758 MB RAM, 1 GB user ROM
Vibrant: 512 MB RAM, 2 GB user ROM
Liquid E: 512 MB RAM, 200 MB user ROM
The Vibrant can have more apps installed but the MyTouch should be better at multitasking (and 1 GB space for apps seems like plenty). Either phone should be far better than the Liquid which is seriously constrained by the small ROM.
Is this generally correct? If so, I'm definitely leaning towards the MyTouch 4G.
thanks!
Yes thats some what correct. In this case you might want to go with MT4G due to superior hardware capabilities. Vibrant has issues and you will need lagfix before you can work it fully but on MT4G is good to go out of the box if you are android normal user.
If you look at quadrant benchmarks for Vibrant against MT4G. The MSM8255 (2nd gen snapdragon) CPU and Adreno 205 GPU blows away the Hummingbird CPU and SGX 540 GPU. ATM MT4G and DHD is the fastest android device in market. With MT4G you have elegant balance in ROM/RAM for nice performance. BTW MT4G has 4GB ROM but 1GB user accessible.
Thanks. I'm going to try and get the MT4G.

Default Swapfile on Optimus 3d

Hi,..sorry if its been asked before.
Ive looked for the swapfile thats been autoload on O3D, in froyo i found 120000 as default value, and on leaked gb by indoptimus i found 122880. Is it safe to raise the value, ive tried to raise it to 322680 (in my noob thought its 320mb), with default swappiness (60). then i open terminal and check free memory, its read as i changed. so im asking to the pro here (i mean any1 here except me /cause im noob), is it safe to change it? And where is the actual swapfile place ? Is it internal sd, eksternal sd, or inside internal sd partition (cause we lost much memory from our internal sd from the beginning).
thanks for all reply, pardon me for my bad english, and sorry for these noobs question.
edit : did my self an experiment,...idk but it seem the cpu clock is working better now / more efficient (checking with System tuner pro). do a multitasking (3 app / camera, dolphine browser, yahoo messenger, and the cpu remains under 60% usage /average.
Well it is a file swapfile partition that Andora used as paging. But here's where the theory, the bigger the better??? I take up room? etc, etc, etc.
Normally you use a paging 128 mg. This is how we have configured on your terminal. To say that the swap partition is created on the phone's internal memory, Osea in the 8 gigs. It saves space and from my point of view and experience of the HD2, not noticeable veneficios between 128 and 256, much less to 512mg.
Whether 128 is more than enough.
Thanks for your reply acura, its help me to know better. what i still dont understand is, o3d is come with 8gb of internal memory, and when we power on, its only give us less than 5gb free space, even if i uninstall bla bla bla apk from the system apk, its still not come even near 7gb. Does the rom took internal space?
do we have a chance to raise our ram to 1gb? Or is it a separated hardware?
danielkaboom said:
Thanks for your reply acura, its help me to know better. what i still dont understand is, o3d is come with 8gb of internal memory, and when we power on, its only give us less than 5gb free space, even if i uninstall bla bla bla apk from the system apk, its still not come even near 7gb. Does the rom took internal space?
do we have a chance to raise our ram to 1gb? Or is it a separated hardware?
Click to expand...
Click to collapse
well you uninstallthis and that and still your phone boots ain't it? all in all at least one gig is reserved for system android etc
jimakos29 said:
well you uninstallthis and that and still your phone boots ain't it? all in all at least one gig is reserved for system android etc
Click to expand...
Click to collapse
yup,..still boot and running just fine,..1 thing i notice is that now the HotPlug govenor is doing its job faster,..i mean, open app a, b and c, then i go to system tuner pro to check cpu usage before i put it to standby mode, and its really fast to get lower from 1ghz to 800mhz, 600mhz and stay at 300mhz(mostly single core is active), and the usage is between 5% - 25%.
power on back, open 3d games, press home menu, and check again, its dual core are running in about 70%-100% on 800mhz-1ghz.
guess im more enjoying my phone now,..less overheat on the display when the screen is up for browsing, playing.
whats still bothering me is, is it safe to put it that way? i mean, ive heard that swapfile sometimes must be formatted to get clean,..is it true? and if its true, how can i formatted it (ramzswap0 located in /dev/block/ramzswap0). for now, what i did is just swappoff it and then swappon it,...in hope to get it clean file (LOL,..noob way). any suggestion?
acura2201 said:
Well it is a file swapfile partition that Andora used as paging. But here's where the theory, the bigger the better??? I take up room? etc, etc, etc.
Normally you use a paging 128 mg. This is how we have configured on your terminal. To say that the swap partition is created on the phone's internal memory, Osea in the 8 gigs. It saves space and from my point of view and experience of the HD2, not noticeable veneficios between 128 and 256, much less to 512mg.
Whether 128 is more than enough.
Click to expand...
Click to collapse
so basically whats better?

[Q] About swap space, this device and cyanogenmod

This may be a general question for all android devices or not but I was curious about adding swap space to this device. It has 1 gig of ram and many may consider that to be enough, and it might be. I have cyanogenmod 10.2 installed and tried to enable zram, 10% seems to be the best setting as anthing higher caused a game to pop up a notice saying something about low memory and defaulting to lower values. When I checked to see if zram was used however it turns out it was, about 25mb - 34mb after booting. The issue with zram is when multitasking with lecturenotes and moonreader, The tablet would reboot and my notebook that was open in lecturenotes would be missing notes I took or the settings would be greatly messed up, or both. This was with 10%.
I am thinking since it was used, it might be helpful to have an sd card for this reason, to aid in multitasking. This is important to me because I run several apps at once (I wish cyanogenmod had multi windows, and google wouldn't threaten over it). So the question is will there be a benifit to buying an sd card on ebay (class 10 of course) and using it as swap space. It seems this tablet might be on the cusp of the memory being enough. Also I am thinking this might help to future proof it a bit when updating to newer releases of gyanogenmod. The sd card I was thinking of is 4 gigs and may plan on having 1gb swap space (this tablet is for school and other work). The tablet has 32gb storage and that is more than enough for me (I am only using 3gb of space) so I wont need to add anymore storage.
I should also add that when multitasking without zram enabled, the tablet reboots less but still has done it, and so far nothing has been lost in my notebooks. I am thinking that the memory of 1gb is starting to reach its limit, with no apps running I am consuming about 600mbs of it.
vanquishedangel said:
This may be a general question for all android devices or not but I was curious about adding swap space to this device. It has 1 gig of ram and many may consider that to be enough, and it might be. I have cyanogenmod 10.2 installed and tried to enable zram, 10% seems to be the best setting as anthing higher caused a game to pop up a notice saying something about low memory and defaulting to lower values. When I checked to see if zram was used however it turns out it was, about 25mb - 34mb after booting. The issue with zram is when multitasking with lecturenotes and moonreader, The tablet would reboot and my notebook that was open in lecturenotes would be missing notes I took or the settings would be greatly messed up, or both. This was with 10%.
I am thinking since it was used, it might be helpful to have an sd card for this reason, to aid in multitasking. This is important to me because I run several apps at once (I wish cyanogenmod had multi windows, and google wouldn't threaten over it). So the question is will there be a benifit to buying an sd card on ebay (class 10 of course) and using it as swap space. It seems this tablet might be on the cusp of the memory being enough. Also I am thinking this might help to future proof it a bit when updating to newer releases of gyanogenmod. The sd card I was thinking of is 4 gigs and may plan on having 1gb swap space (this tablet is for school and other work). The tablet has 32gb storage and that is more than enough for me (I am only using 3gb of space) so I wont need to add anymore storage.
I should also add that when multitasking without zram enabled, the tablet reboots less but still has done it, and so far nothing has been lost in my notebooks. I am thinking that the memory of 1gb is starting to reach its limit, with no apps running I am consuming about 600mbs of it.
Click to expand...
Click to collapse
Well in my own personal testing i could not see any benefit while extracting 700mb archives under android with 4gb swap space on a 40mbs microsd card, while under full linux desktop with a same workload, swap differently helps keep the system smooth under heavy io load. The conclusion i drew was the android platform deals to memory management differently than the typical desktop os, due to slower emmc chips used as a boot disk for the majority of android devices using this slow, already bottlenecked memory as swap space doesn't make sense (not to mention the use of 2gb swap space on a limited 16gb storage etc), so android runs almost completely in ram, with stricter memory management and allocation allows android to run fine without swap space, although because of this, androids memory management makes little uses of available swap space
JoinTheRealms said:
Well in my own personal testing i could not see any benefit while extracting 700mb archives under android with 4gb swap space on a 40mbs microsd card, while under full linux desktop with a same workload, swap differently helps keep the system smooth under heavy io load.
Click to expand...
Click to collapse
I've been running my desktop without swap for the last 10 years, and as long as you have enough RAM for all your running programs, there will be no problem at all.
Extracting an archive is a mostly sequential operation (single read stream, single write stream), so it also doesn't benefit from caching, which could use the memory that is freed by swapping.
_that said:
I've been running my desktop without swap for the last 10 years, and as long as you have enough RAM for all your running programs, there will be no problem at all.
Extracting an archive is a mostly sequential operation (single read stream, single write stream), so it also doesn't benefit from caching, which could use the memory that is freed by swapping.
Click to expand...
Click to collapse
Ahh that makes sense. I wasnt sure if swap had an effect directly on the extraction, but seem keeped the rest system more stable/ smooth duing the process in the case of GNU/Linux, with swap off similar operations such as installing packages would more oftern lock the tablet up. Might be a placebo though
I also dont set swap on my Linux desktop, as it has plenty of ram but the benitfit of swap space is somewhat more noticable due to the lack of ram on the tf700.
JoinTheRealms said:
I also dont set swap on my Linux desktop, as it has plenty of ram but the benitfit of swap space is somewhat more noticable due to the lack of ram on the tf700.
Click to expand...
Click to collapse
I just want to share my user experiences on the swap space... It does seem to improve the tf700 with swap space due to the lack of RAM (1GB)..
Thanks for all the useful posts
Thanks for all the posts, I have my sd card on the way. I will post my experience when I get my sd card but I am sure it is safe to say there will be a benefit. I use linux to at home and have 8 gigs of ram on that computer, I lessen the swap after install to about 512mb because 8 gigs is more then enough. I leave some however just incase of any issues like ram going bad. On another computer in the house that has limited ram (1.5 gigs) I have enabled zram (384 mb) and added two old flash cards (1 gig each) to a pci raid card and those were converted to swap. I then altered the fstab to reflect the order of priority I wanted them used in. The reason is that when the swap is used from the hard drive, and the hard drive is being written to, can cause a slow down. So with the 2 flash cards at 1 gig each (the swap seen as 2 gigs) it seemed to speed it up. I just posted that because of the nix users and it seemed like a good plan to run it that way.
Ok, got the sd card
So I recieved the sd card today and applied the swap space to it using root swapper (max setting is 256mb, I figured i can find a way to increase it later if I need to). The defaut location in many of the swap applications will not work on this device however, the sd card mounts at /storage/sdcard1 in my case. So it has to be entered manually (might just be cyanogenmod). Also the device was picky when insalling the card, it would only say blank sd card or cannot read filesystem. I had to install the card in the dock, format it from cwm recovery, (vfat if I remember correct, ext2 and ntfs had issues, avoided ext3 and ext4 cause journaling will cause more wear and tear).
The sd card is a scandisk ultra sdhc uhs-1 8 gigs. From my research that is the fastest this tab can handle. I also use optimising programs like greenify (epic save everything app), pimp my rom (almost every tweak applied), and some pretty efficient tweaks in the settings as well. I also have HALO))) installed and working (epic multiwindow app that works with native programs and almost any rom).
The resuts:
I tested it many ways, I rebooted to see use (none was used because swap starts after boot), I opened apps normally (browsers and things), and it showed 9kb's was used. I then put it to the tests, I open four windows in halo, these were youtube, moonreader pro with a pdf ebook, lecturenotes (awsome note and handwriting app with tons of functions), and Supernote pro (not the best note app). Constantly switched between the apps and messed with settings with them open. The max of swap used was around 10mb(keeping in mind that when I switch windows the app(s) I leave get paused making it hard to tell actual usage because I had to swith the terminal and type "free". I then ran antutu bechmark and gpubench (my tab stills score pretty well) and got a little higher swap usage but not much.
As for the feel of it, it seemed to help when opening many windows in halo, this is the primary reason for my doing this. As for other more normal uses I really didnt see too much of a difference, I did test games however and they did seem a little better (could be placebo) but I am not really sure why they would except android cached other apps to free memory. Reopening apps seemed faster. Also because of apps like greenify my memory usage is decreased so I am sure typically swap would have seen more use.
The conclusion is that at this point I really didn't notice much of a boost for any normal use, but I will definately keep the swap space on due to the boost when using halo and not to mention that I will be updating to android 4.4 soon and it might need more memory. Swap at this point seems more like a pre emptive strike, but it does help with multitasking.
about swap
://androidforums.com/boost-mobile-warp-all-things-root/610449-ram-swapping-without-swapper2.html I actually followed a guide on android central and redid the swap file to 1 gig to swap instead of using a program, this worked better. (add http in front), when i disabled swap it was noticeable that there was a boost. then reenabled it this method.

Categories

Resources