[Q] Can Swap on NAND kill the NAND itself? - Android Software/Hacking General [Developers Only]

Can Swap on NAND kill the NAND itself?een covered several times already on different forums,
but I am still seeking for some accurate clarifications regarding whether or not a Swap partition on NAND can eventually kill the NAND itself.
I have a kindle-fire fire with CM9 and unfortunately I have noticed a high ram consumption by ICS. I tried the 99V6_supercharger script as someone already suggested, but unfortunately that didn't help much.
I'm always left out with few megabytes of free ram with just the stock browser and Gmail and plume opened, and if I open few more the OS becomes unusable due to lack of free ram.
So basically my question is, should I create a 500mb swap partition in NAND? Will it damage and eventually kill the NAND itself?
Thanks

anyone?

The short answer is "no, not in your phone's normal lifetime and under normal usage". AFAIK, NAND memory is based on the very same technology that micro-SD cards are made from.
While this may have been true in the very early days of static memory chips, just recently (a few months back) a study proved that it would take I don't remember exactly how many (but it was in the tens of millions order of magnitude) write cycles to "kill" all the cells of a NAND chip (allowing the wear-levelling algorithms to spread the data elsewhere, and then killing those cells in turn) and make it unreliable enough.
If you were running a supercalculator farm making very heavy disk-intensive calculations, it would take more than 2 years of continous 27/7 writing to completely kill such a memory -or a modern SSD device.
And who uses a phone for more than 2 years nowadays ?
(plus, if you actually set up a swap partition on your device, you'll notice that unless you increase the parameter proc.kern.vm.swappiness to more than 30, your device actually doesn't swap that much, nor does it swap continously. Oh, and 500Mb for a swap partition is overkill for a phone : it will seldom use more than 128Mb, the necessary quantity for two dalvik VMs with the default size of 64Mb that's set on most Gingerbread devices nowadays. )
(EDIT2 : but if you're still worried, I got a suggestion : get ahold of a class-10 micro-SD card -don't be stingy on the quality, go for the higher-value brands like Samsung or Corsair/Kingston- and set up the swap area over this. If it breaks down, you ust swap a new one in and you're back on track.. )

Related

[IDEA] Smart Swapper

I was thinking the other day about people opinions about using swaps and what the swappiness should be set to. I thought about how at sometimes during heavy use a higher swappiness would help while at other times it could slow things down. I was wondering if it would be possible to make a "smart" Swapper app that ran in the background and automatically adjusted the swappiness according to how much free memory is needed. For example when the phone is idle in your pocket swappiness would be at 10 but then as your started to browse the web or use GPS it would increase swappiness to allow you to have more free memory. Feel free to tell me why this is not practical or possible, it was just a thought I had.
I don't this its a case of being impossible
the question is why?
if your phone is 'sleeping' it probably isn't doing much with swap, so reducing swappiness won't achieve anything.
increasing swappiness when your phone comes to some load threshold will only increase the 'load' on swap as all of a sudden you want to dump more stuff from real memory into swap
tbh I don't understand why so many are obsessed with swap.
my advice , keep swappiness at default, and as for size of swap, large
why large?
good question, as you never really fill more than 40mb..
the reason for 'large' is 'wear levelling' your swap takes a hammering, if this partition is large then each block is going to have less writes on it than a smaller swap partition over a given period of time, thus increasing the life span of your sd card.
Agreed, playing with swappiness doesn't really help a whole lot.
One of the bigger issues (imo) is how once you have swap turned on the kernel will swap inactive pages out in order to make room for IO caching. If your device is sleeping, a lot of pages are suddenly inactive.
While at first it might seem like you'd want the ram to make up for a slow SD card, swapping out to the same device in order to make room for cache is counterintuitive. Unfortunately there is no way to cap the total amount of ram that can be used for cache. The logic is that unused ram and inactive pages can be put to better use to speed up IO.....except on devices with extremely limited ram and IO like most smartphones.
It's pretty unlikely that anything like that will make it back into the linux kernel any time soon. :\
Then again you never know Lunix is open sourced as well as android anything is possible
The idea is correct, but as said, it isn't possible. Don't count on any linux changes in the future on this. On the other hand, i think there is a possibility, but this should be calculated.
Swapiness is set on boot, right? If i change it when running my phone, would this make any difference on further use?
Now my suggestion is, find out what swapiness is ideal. When the program can calculate the ideal swapiness level, based on how much RAM is used over time, this would be nice? It would write this level down in a userinit, and when you reboot the phone, it would use this level as a reference point on swapiness.
Only downside is that you can't figure out the ideal swapiness, it depends on the phone, apps and personal preference.
Anyone has comments on this idea?

not clear to me from search what is current state of swap && / || CCache

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...

[Q] Making Swapfile on Gtab 7+?

hi guys,..
i want to ask is there any way i can make swapfile on gtab 7+ running hc 3.2? or there is no posibility to make swapfile on honeycomb? i've tried to make the swapfile using dd command from terjinal, but somehow im stucked on setting permission for the file, the file i've created always have special permission that i can't change to rw-r-r, it always stayed rw-rSw-r, im a newbie on linux things, and willing to learn.
any help really appreciate.
thanks.
Okay, you say that you're a newbie to linux. That's fair and reasonable. I'm going to try and teach you some things by way of asking questions. They might sound like I'm attacking you, but I'm not...
Do you know you are trying to create a swap file? What do you hope to gain by doing so?
Is this one of those mythical magical things that someone claims will make the tablet run 50395920 times faster, allow it to brew coffee, and make your car get better fuel mileage?
...and some answers...
Within the android environment, a swap file is a BAD THING. The entire system is designed to drop stuff out of memory if/when it needs more memory, and the overhead of a swapfile will cause more harm than good.
Take care
Gary
garyd9 said:
Within the android environment, a swap file is a BAD THING. The entire system is designed to drop stuff out of memory if/when it needs more memory, and the overhead of a swapfile will cause more harm than good.
Click to expand...
Click to collapse
It's not that dramatic. Most of "the overhead of a swapfile" is overhead you're already committing to by utilizing a VMM (Virtual Memory Manager). The Dalvik VM doesn't do a whole lot of its own memory management so implementing a swapfile at the OS level, which is what the OP is looking to do, wouldn't have a huge impact on performance.
The only time where you'd have any real overhead of maintaining a swapfile is when memory is full and the OS pages out memory to disk. But remember that the alternative is to close down the process and run some garbage collection. Both are intensive actions - swapfile is I/O intensive while GC is CPU and memory intensive - so you're really trading one source of overhead for another.
To answer the OP's question, it sounds like you haven't rooted the tab. You would need to be root in order to change the perms as you described. If you are rooted, make sure you're using the right command to set permissions - I haven't tried this specifically on Android but from my *nix experience, the command you want is chmod 644 <path to file>
---------- Post added at 09:24 PM ---------- Previous post was at 08:39 PM ----------
Almost forgot, what kernel are you using?
im using stock kernel 2.6.36, kk6 rooted. i've tried to chmod the swapfile, but still cant change the permission, i usually use root explorer to change the permission, but now it doesn't take effect. the file permission r8 now is rw-rwSr--, the "S" thing is making the swap cant be aplied (i guess).
back there when i use optimus (gingerbread), swapfile is default from stock rom. is it have something to do with honeycomb?
thanks for your reply.
garyd9 said:
Okay, you say that you're a newbie to linux. That's fair and reasonable. I'm going to try and teach you some things by way of asking questions. They might sound like I'm attacking you, but I'm not...
Do you know you are trying to create a swap file? What do you hope to gain by doing so?
Is this one of those mythical magical things that someone claims will make the tablet run 50395920 times faster, allow it to brew coffee, and make your car get better fuel mileage?
...and some answers...
Within the android environment, a swap file is a BAD THING. The entire system is designed to drop stuff out of memory if/when it needs more memory, and the overhead of a swapfile will cause more harm than good.
Take care
Gary
Click to expand...
Click to collapse
thanks m8 for your lighten up of linux, i really appreciate it. just from my experient when im using optimus (gingerbread) i never felt lack of memory when using multitasking (it only has 512mb ram). but now when i using gtab (with 1gb ram or 778mb?) first it fast on multitasking but about 10 minute later it getting slower, when i check with task manager, it only has 80mb left??
is it me or is it gingerbread have better ram management than honeycomb, and so if it is, im trying to make swapfile in hope that its getting better. i use v6 supercharger, kill all proccess when it turn to standby by automatic, overclocking to 1,6ghz, but still i can make the ram more efficient when running on multitasking.
hope you understand for what im going to achieve.
thanks.
h2g2 said:
It's not that dramatic.
Click to expand...
Click to collapse
Are you suggesting that using an OS-level "generic" swapfile on flash memory is better or even equivalent to using a system/purpose built solution?
The linux kernel has no way to know if the memory its swapping out is even needed anymore. The android system, however, does know this - and will often discard allocations.
Let's say you run two applications: email and the browser. The browser has several pages loaded with flash, and lots of memory intensive stuff going on. Also in memory is the code that syncs your email in the background and several other "non critical" services (such as SMS, latitude, etc.) and a few critical services (such as some wifi support, display support, framework, etc.)
Keep in mind that if android requests memory, and there's a swapfile, the kernel will claim it has memory backed by swap... So given a large enough swapfile, the kernel will never tell android that it's running short on memory...
Given the above situation, the user now wants to run Angry Birds. There isn't enough physical RAM to support all of the above in memory AND Angry Birds. What will happen?
If there's no swapfile, android will see there isn't enough RAM to support it, and simply drop the browser and email client from memory, but keep the services in memory. Angry birds loads, and the user is happy.
IF there IS a swapfile, however, then android will see that there is RAM to support AB along with everything else in memory, and just load Angry Birds. When that happens, the linux kernel will have to swap pages of memory out to the flash memory. The KERNEL doesn't know the difference between the email client, the email service, the browser, or any other "non-critical" service. All those memory pages are flagged the same. So, perhaps the browser gets swapped out. (wasted cycles - it could have been discarded.) The email client is retained in RAM, but the email service is swapped out to flash. Angry Birds loads. 5 minutes later, Angry Birds freezes and gets jumpy... why? Because the email service has to be swapped back into RAM, and something else swapped out in its place. This time it was latitude. A few minutes later, latitude wants to update your position, so the same thing happens. What gets swapped this time?
Why spend the cycles swapping things in and out of RAM? There is plenty of memory on these devices to support all the services and memory hungry games. If some game has a memory leak, you SHOULD be getting errors from running out of memory and NOT blissfully swapping things to flash.
I'm not going to tell people how to use their devices. I'm going to try and give them advice, but I certainly can't force people to take it. As a matter of fact, I'll even encourage the technical minded to explore and break things to learn on their own.
However, when a person asks the question I see in the OP, and admits that they are new to linux, then I suspect that they aren't technically minded and exploring, but blindly following the "suggestion" of someone else who promises all kinds of silly things. It reminds me of someone who disabled kernel panic reboots and claimed that it was a tweak to make the system more stable... and had many people actually believing that.
There's a good reason why google hasn't enabled swapping, and there's even less of a reason with devices that come with 1GB of RAM.
Take care
Gary
---------- Post added at 01:45 AM ---------- Previous post was at 01:25 AM ----------
danielkaboom said:
is it me or is it gingerbread have better ram management than honeycomb, and so if it is, im trying to make swapfile in hope that its getting better. i use v6 supercharger, kill all proccess when it turn to standby by automatic, overclocking to 1,6ghz, but still i can make the ram more efficient when running on multitasking.
hope you understand for what im going to achieve.
thanks.
Click to expand...
Click to collapse
First of all, try the same thing without that "supercharger" script. I've made clear my thoughts on that. In this case, using that script may or may not be allowing HC to do what its designed to do in regards to memory management. I'm not saying you should delete it - but to run tests without it.
If you are running low on FREE memory, that's not a bad thing. What good is the memory doing if it's not being used? Android will let an unused application linger in RAM as long as they wants so long as nothing else needs that RAM. As soon as something else needs that RAM, those unused apps will be purged (garbage collection.)
Having a swap file directly contradicts any effort to purge things from memory. A swapfile will encourage the system to swap things to flash as virtual memory. Sure, your "free memory" number might be bigger, but it will slow the system down when it's swapping things out to and in from flash memory. (A blunt question Are you chasing numbers or actual performance?
How do you expect to make memory MORE efficient by always having it be unused? Memory that's not being used is wasted. If my desktop machine (that has 16GB of RAM) has only 6GB being used, then I have 10GB of RAM wasted. I'd rather that memory be used to store an application I might go back to using, or used as cache. Completely unused RAM is completely wasted RAM.
I understand that you might be caught up in the whole thing with overclocking, having as much free RAM as possible, and having nice benchmark numbers. The thing is.. NONE OF THAT MATTERS.
Want higher benchmark numbers? I can make you a kernel that will give you insanely high numbers. Your device will suck for actual use, but you'll get high benchmarks.
Want a big "free RAM" number? Never run any apps, never get email, don't do anything at all with the device. It'll be an expensive paperweight, but you'll always have lots of free (and completely wasted) RAM.
Try this: make a backup of your system and then go back to stock. Use your tablet in a factory state for a few days. Then root it and disable some of the things that might be chewing the battery. Don't overclock, don't install scripts, and don't install a custom kernel. Use the device like that for a while. Actually USE the device - don't benchmark it, check task managers, etc. Just use it.
Now, how does it feel? No script, kernel, or anything else will make a dramatic performance increase. They can (and often do) make things slower, however. (That's why I'm very careful about modifications I make to my kernel...)
After using it stock for a few days, come back and tell us what you think - what you wish would be better in actual day to day use. (Again, benchmarks and numbers don't mean much...)
Take care
Gary
yes Gary,...to be honest, im blindly follow every1 that claims can tweaks or anything like tha, but when i tested it and using it, if its making my device getting "better" i kept it, if its making it worse than before, i let go.
in my opinion, slow, fast or faster is relative, it depends on every1 needs. for me loading game such as finalstrike hd in 5 sec is fast, but maybe different to others by loading it 20-30 sec is acceptable.
but if you said swapfile is bad and will only making it worse, then i'll accept that, but after im testing it. for me, sugar is not sweet until my tounge said so, no offence.
again, thanks Gary for the explanation, thanks for opening my mind.
edit : ill try to follow your instruction first.
You should do what you feel like, but please don't get caught up in lots of people telling you that they have magic bullets to fix things (that really aren't even broken.)
That being said, you are having a technical problem and I just can't resist information sharing.
What directory are you trying to create the file in? /sdcard (or /mnt/sdcard) won't work.
Try /data
(/mnt/sdcard == /sdcard.. and they will force certain permissions via fuse/vold.) Unlike GB, with HC /data and /mnt/sdcard use the same space. (/mnt/sdcard is actually a fuse from /data/media.) (In GB, /data space was very limited. That's not the case with HC.)
Gary
still failed,...:
- create a file in /data (named swapfile.swp), using terminal
# dd if=/dev/zero of=/data/swapfile.swp bs=1024 count=128000
- check from root explorer, the file is now created.
# mkswap /data/swapfile.swp
# swapon /data/swapfile.swp
swapon /data/swapfile.swp = Function not implemented
any sugestion?
edit : the permission is now can be change to rw-r--r--(thx Gary)..but its still failed to swapon,..
edit 2 : from what i've read from other pages and sites,..is it because "kernel not support"?
garyd9 said:
Are you suggesting that using an OS-level "generic" swapfile on flash memory is better or even equivalent to using a system/purpose built solution?
Click to expand...
Click to collapse
There is no "system/purpose built solution" - the Dalvik VM uses the Linux kernel VMM functions for low level memory management (http://developer.android.com/guide/basics/what-is-android.html).
The linux kernel has no way to know if the memory its swapping out is even needed anymore. The android system, however, does know this - and will often discard allocations.
Click to expand...
Click to collapse
Yes it does. The VMM knows which pages are active, which are inactive, and - if an application has called free() on a pages it previously malloc()'d, it will know which pages are expired.
In fact, the VMM will often know more than the Dalvik VMs because each application runs in its own Dalvik thread with its own dedicated heap. Any individual Dalvik instance will only know the disposition of the heap for its own application.
The VMM, on the other hand, has visibility of all Dalvik threads and will know which threads are idle and which are active, which Dalvik threads have run garbage collection and free()'d a portion of their heap, etc.
Keep in mind that if android requests memory, and there's a swapfile, the kernel will claim it has memory backed by swap... So given a large enough swapfile, the kernel will never tell android that it's running short on memory...
Click to expand...
Click to collapse
No, it won't. That's not how the swapfile works. What you're describing is more akin to memory-mapped file I/O, which is related (in that the VMM plays a role in managing that address space) but not at issue (it's a completely separate operation from memory allocation and de-allocation).
Memory is requested by giving the kernel a malloc() command. The VMM will then check its page cache (the size of which is constrained by physical memory - regardless of whether there is a swapfile or not) and look for available space. If space isn't available, then the VMM will look for pages marked as expired. If there aren't enough expired pages, it will look for inactive pages (pages allocated by processes that are idle or supsended).
At this point, the VMM will either 1) discard the contents of the expired and/or inactive pages until enough free pages are available (if no swapfile is available) or 2), write the contents of the expired and/or inactive pages to the swapfile before discarding them until enough free pages are available.
Note that the presence or absence of the swapfile has no bearing on what pages are chosen. And again, regardless of whether there is a swapfile or not, if there aren't enough expired and/or inactive pages to get rid of, malloc() returns a null pointer. In otherwords, you will get out of memory errors even with a giant swapfile.
Given the above situation, the user now wants to run Angry Birds. There isn't enough physical RAM to support all of the above in memory AND Angry Birds. What will happen?
If there's no swapfile, android will see there isn't enough RAM to support it, and simply drop the browser and email client from memory, but keep the services in memory. Angry birds loads, and the user is happy.
IF there IS a swapfile, however, then android will see that there is RAM to support AB along with everything else in memory, and just load Angry Birds. When that happens, the linux kernel will have to swap pages of memory out to the flash memory. The KERNEL doesn't know the difference between the email client, the email service, the browser, or any other "non-critical" service. All those memory pages are flagged the same. So, perhaps the browser gets swapped out. (wasted cycles - it could have been discarded.) The email client is retained in RAM, but the email service is swapped out to flash. Angry Birds loads. 5 minutes later, Angry Birds freezes and gets jumpy... why? Because the email service has to be swapped back into RAM, and something else swapped out in its place. This time it was latitude. A few minutes later, latitude wants to update your position, so the same thing happens. What gets swapped this time?
Click to expand...
Click to collapse
So bearing in mind that the Linux kernel VMM is ultimately responsible for choosing what gets dropped or swapped out of memory and also bearing in mind that only inactive or expired pages are eligible to be dropped/swapped, we can see that the situation you describe will never happen.
The behavior of, from the user's perspective, what applications get shoved out of active memory (regardless of whether they end up in the swapfile or in /dev/null) doesn't change. In the same way that the Linux VMM will never drop pages associated with an active process (such as the email sync service, the Wifi driver, etc), the Linux VMM will likewise never swap these pages out either.
Why spend the cycles swapping things in and out of RAM? There is plenty of memory on these devices to support all the services and memory hungry games. If some game has a memory leak, you SHOULD be getting errors from running out of memory and NOT blissfully swapping things to flash.
Click to expand...
Click to collapse
Consider the scenario you spelled out previously - without the swapfile, the pages associated with the Browser app will get dropped and make room for Angry Birds. Good news: Angry Birds starts up faster.
With the swapfile, the pages associated with the Browser app will get swapped out to make room for Angry Birds. This will take longer since there's some file I/O involved. Bad news: Angry Birds starts up slower.
So what's the use case for the swapfile? What if you want to go back to the browser again? Without the swapfile, the Browser is gone. You have to launch it - the application binary needs to be read off disk, executed, the heap has to be re-allocated, re-initialized, and program data needs to be populated. The page you wanted is gone - you need to fetch that again. More waiting while it downloads from the server and the HTML code is rendered on the screen.
In this scenario, reading the heap back into memory from the swap file is actually more efficient than recreating it - even if you ignore the obvious benefit of not having to relaunch the app and reload the page, there's substantial overhead associated with relaunching the app.
So that's the use case - maybe it's not applicable to you if (although maybe someone who wants to go back and forth between Angry Birds and a cheat guide on a G1 might appreciate this) but if you are multitasking across several memory-intensive apps, then the benefit of not having to re-invent the wheel, so to speak, to recover the application state can outweigh the cost of paging the application state out to disk.
I'm not going to tell people how to use their devices. I'm going to try and give them advice, but I certainly can't force people to take it. As a matter of fact, I'll even encourage the technical minded to explore and break things to learn on their own.
However, when a person asks the question I see in the OP, and admits that they are new to linux, then I suspect that they aren't technically minded and exploring, but blindly following the "suggestion" of someone else who promises all kinds of silly things. It reminds me of someone who disabled kernel panic reboots and claimed that it was a tweak to make the system more stable... and had many people actually believing that.
Click to expand...
Click to collapse
I have no problem with dissuading people of the notion that some hack is going to instantly and unequivocally make their system better. But I think the proper response, especially on a forum like this, is to present the facts of the matter and not just a knee-jerk contrarion reaction. Simply dismissing the swapfile as a "BAD THING" doesn't really help the OP learn more about it, at the very least.
I'm with you on disabling kernel panic reboots, though. That's just stupid.
There's a good reason why google hasn't enabled swapping, and there's even less of a reason with devices that come with 1GB of RAM.
Click to expand...
Click to collapse
Maybe, maybe not. Android 2.1 and earlier didn't implement JIT. Android 2.2 and earlier didn't implement EXT4. Android 2.3 and earlier didn't implement GPU-accelerated UI compositing. Android 3.2 and earlier didn't implement ASLR. Does that mean these were considered undesirable by Google at one point in time? Or were they always on Google's list of things they wanted to do and they just hadn't gotten around to them yet?
---------- Post added at 01:56 AM ---------- Previous post was at 01:41 AM ----------
danielkaboom said:
still failed,...:
- create a file in /data (named swapfile.swp), using terminal
# dd if=/dev/zero of=/data/swapfile.swp bs=1024 count=128000
- check from root explorer, the file is now created.
# mkswap /data/swapfile.swp
# swapon /data/swapfile.swp
swapon /data/swapfile.swp = Function not implemented
any sugestion?
edit : the permission is now can be change to rw-r--r--(thx Gary)..but its still failed to swapon,..
edit 2 : from what i've read from other pages and sites,..is it because "kernel not support"?
Click to expand...
Click to collapse
Yes, the kernel needs to have swapfs support. If you've ever played around with EXT4 kernels or ROMs that required EXT4 kernels, for example, it's kind of the same idea.
It sounds like the stock GT7+ kernel does not have this so you will need to find a custom kernel that does. I'm going to go out on a limb and guess that garyd9's kernel does not support swapfs.
Without the kernel, you're out of luck.
Regarding your situation on your Tab, it sounds like you've got an app or two that's misbehaving. Have you tried throwing up a CPU monitor? It would be useful to know whether the slowdown is caused by the CPU getting busy, and whether this load is from a single app or not.
Thank you for explaining that. Are there any examples, other than the one you mentioned, in which Android would benefit from a swapfile?
reading both pros and cons about swapfile really makes my head spinning,... im trying to understand it little by little. thanks guys for the explanation.
and yeah, guess im run out of luck,..(cause i don't have enough skill to make the kernel on my own,..sigh).
thanks.
danielkaboom said:
reading both pros and cons about swapfile really makes my head spinning,... im trying to understand it little by little. thanks guys for the explanation.
and yeah, guess im run out of luck,..(cause i don't have enough skill to make the kernel on my own,..sigh).
thanks.
Click to expand...
Click to collapse
It is a complicated issue with lots of tradeoffs in both directions.
I'm still curious as to the specifics of your problems, though. Garyd9 is correct in saying that creating a swapfile may not help your particular issue but that doesn't mean there isn't some other way to fix it. We just need more information about what's going on on your tablet.
---------- Post added at 05:49 PM ---------- Previous post was at 05:29 PM ----------
nyarltep said:
Thank you for explaining that. Are there any examples, other than the one you mentioned, in which Android would benefit from a swapfile?
Click to expand...
Click to collapse
Fundamentally, it breaks down to a store vs. recalculate issue - do you store memory pages to the swap file and incur the storage I/O overhead or do you discard it and recalculate it later and incur the cpu and memory I/O overhead? All of these resources are in short supply on the GT7+.
A swapfile works best with applications that maintain steady states that can easily be swapped out and back in as needed. A swapfile is least effective for active background processes.
If, for example, you're running out of memory running too many apps in the background - think clients for sync services, streaming media, system monitoring, etc. - a swapfile is not going to help.
However, if you're running into situations where you are switching between multiple apps such as document viewers/editors, and are finding that you need to reload documents as the apps get silently killed in the background, a swapfile could potentially help.
The only real way to know is to test it but without a kernel with swapfs support for the GT7+, it's impossible to say for certain.
from the opinion, i guess using swapfile for backround process is useless, but using it to switching task (for example : im using browser with lot of pages and beside that im doing some paperwork on office aplication) will help a bit, am i r8? if its r8, then im willing to try using swapfile, because i already freeze/uninstall some aplication that running on backround but still give me lags, when i did the example above.
but again, im running out of luck,..until Garyd9 or any1 else kind enough to make kernel that support swapfs,...
thanks for both of you, for your effort to answering my noob question.
regards,
dan
PS : Gary, i've tried your instruction, and yes it makes my daily use better,...though im still curious using swap,...hehehe.
danielkaboom said:
from the opinion, i guess using swapfile for backround process is useless, but using it to switching task (for example : im using browser with lot of pages and beside that im doing some paperwork on office aplication) will help a bit, am i r8? if its r8, then im willing to try using swapfile, because i already freeze/uninstall some aplication that running on backround but still give me lags, when i did the example above.
but again, im running out of luck,..until Garyd9 or any1 else kind enough to make kernel that support swapfs,...
Click to expand...
Click to collapse
Background processes are fine to swap out if they're steady state, it's active background processes that aren't going to benefit from a swapfile.
However, the lags you're experiencing may continue to persist depending on what is causing those lags. A swapfile won't help if you've got a poorly-optimized app running, particularly one that is not efficient with memory allocations. It also won't help if the lags are caused by a Dalvik thread performing garbage collection on its heap (whether the app on that thread is efficient in its memory allocations or not).
My educated guess is that if you are experiencing lags while using an active, foreground application, then this is not a problem that will be fixed with a swapfile. On the other hand, if you are experiencing lags launching new applications or bringing background apps into the foreground, these types of lags may be reduced with the use of a swapfile though the only way to know for sure is to test it.
I don't have time for an indepth reply to h2g2, but I'll reply simply:
You seem to be knowledgable enough to recompile a kernel - so please feel free to pull my kernel sources and initramfs, turn on swapping (samsung has it disabled by default), and try it. Keep an eye on the swapping and memory stats, as well as what's being swapped, etc... You might be surprised.
(If I had time, I'd do the same.. I've been wrong before and I might be wrong again... )
In either case, Daniel, I'm glad that turning off all that excess crap helps. As much as we all complain about this tablet, it actually runs pretty good without many modifications. If you read the changes I've made in the p6210 kernel, you'll see that I really haven't done much to it. The most invasive change was adding stuff that Samsung didn't have in there (such as UV.)
Take care
Gary
garyd9 said:
I don't have time for an indepth reply to h2g2, but I'll reply simply:
You seem to be knowledgable enough to recompile a kernel - so please feel free to pull my kernel sources and initramfs, turn on swapping (samsung has it disabled by default), and try it. Keep an eye on the swapping and memory stats, as well as what's being swapped, etc... You might be surprised.
(If I had time, I'd do the same.. I've been wrong before and I might be wrong again... )
Click to expand...
Click to collapse
Just to be clear, I have no real stake in this except to make sure that the technical facts about the swapfile are presented properly. In much the same way that you've been frustrated hearing about people recommending that they disable kernel panic reboots, I also am frustrated when people have a knee-jerk "swapfile = terrible" reaction that is largely based on FUD.
That said, you're right, I should just test it myself when I've got some free time.
Dusted off my old Nexus One, loaded up a clean install of CM7 and installed a kernel with CONFIG_SWAP=y. I decided to go with a swap partition on my sd card rather than a swapfile but the effect should be the same.
I haven't had time to do extensive testing but so far but I can confirm that swap is working and I haven't yet noticed a major perceptible impact to performance of the device.
Code:
# free
total used free shared buffers
Mem: 403240 379288 23952 0 60
-/+ buffers: 379228 24012
Swap: 62696 27948 34748
# grep "pswp" /proc/vmstat
pswpin 192
pswpout 7059
---------- Post added at 01:37 PM ---------- Previous post was at 12:49 PM ----------
Been switching back and forth between apps for a while now, paying particular attention to apps like Google Earth and the Browser that load up lots of data.
One particular test that seemed to stress the memory subsystem was using the "Print this page" on multi-page articles on graphics-heavy sites like, e.g. Anandtech (had the Snapdragon S4 review up). With swap enabled, there was a delay of 1-2 seconds when switching back to the browser (no doubt from reading the appropriate pages back into memory) but without the swapfile, the session was gone and the page needed to be reloaded, which took much longer than 1-2 seconds.
Some caveats:
1) I used a rather small swap partition (64MB) compared to the amount of memory available on the device (512MB for the N1). This means that I didn't need to do too much tweaking to the lowmemorykiller settings.
2) I set swappiness to 100, which is intentionally a bit heavy-handed (default seems to be 60).
3) I did not tweak other settings such as dalvik.vm.heapsize, vfs.
_cache_pressure, page-cluster and, as mentioned in #1, lowmemorykiller/parameters/minfree.
Code:
# free
total used free shared buffers
Mem: 403240 390824 12416 0 36
-/+ buffers: 390788 12452
Swap: 62696 59684 3012
# grep "pswp" /proc/vmstat
pswpin 6061
pswpout 31228
h2g2 said:
Dusted off my old Nexus One, loaded up a clean install of CM7 and installed a kernel with CONFIG_SWAP=y. I decided to go with a swap partition on my sd card rather than a swapfile but the effect should be the same.
I haven't had time to do extensive testing but so far but I can confirm that swap is working and I haven't yet noticed a major perceptible impact to performance of the device.
Code:
# free
total used free shared buffers
Mem: 403240 379288 23952 0 60
-/+ buffers: 379228 24012
Swap: 62696 27948 34748
# grep "pswp" /proc/vmstat
pswpin 192
pswpout 7059
---------- Post added at 01:37 PM ---------- Previous post was at 12:49 PM ----------
Been switching back and forth between apps for a while now, paying particular attention to apps like Google Earth and the Browser that load up lots of data.
One particular test that seemed to stress the memory subsystem was using the "Print this page" on multi-page articles on graphics-heavy sites like, e.g. Anandtech (had the Snapdragon S4 review up). With swap enabled, there was a delay of 1-2 seconds when switching back to the browser (no doubt from reading the appropriate pages back into memory) but without the swapfile, the session was gone and the page needed to be reloaded, which took much longer than 1-2 seconds.
Some caveats:
1) I used a rather small swap partition (64MB) compared to the amount of memory available on the device (512MB for the N1). This means that I didn't need to do too much tweaking to the lowmemorykiller settings.
2) I set swappiness to 100, which is intentionally a bit heavy-handed (default seems to be 60).
3) I did not tweak other settings such as dalvik.vm.heapsize, vfs.
_cache_pressure, page-cluster and, as mentioned in #1, lowmemorykiller/parameters/minfree.
Code:
# free
total used free shared buffers
Mem: 403240 390824 12416 0 36
-/+ buffers: 390788 12452
Swap: 62696 59684 3012
# grep "pswp" /proc/vmstat
pswpin 6061
pswpout 31228
Click to expand...
Click to collapse
little of my understanding, if a swapfile is made in an external sd, the sd card must have good r/w capability (minimum required a class 6 sd card), what if the swapfile is made in internal sd (since GTab have 12gb planted chip memory), what is the effect?
and so,....would you be kind enough to build a kernel for GTab 7+ that support swapfile? and if you do, can you do with a flashable zip (which i can flash it through cwm recovery?
so i can answer my own question : swap or not to swap?
and of course if you have spare time
thanks
dan
danielkaboom said:
little of my understanding, if a swapfile is made in an external sd, the sd card must have good r/w capability (minimum required a class 6 sd card), what if the swapfile is made in internal sd (since GTab have 12gb planted chip memory), what is the effect?
and so,....would you be kind enough to build a kernel for GTab 7+ that support swapfile? and if you do, can you do with a flashable zip (which i can flash it through cwm recovery?
so i can answer my own question : swap or not to swap?
and of course if you have spare time
thanks
dan
Click to expand...
Click to collapse
I'm using a Class 2 8GB MicroSDHC card from Sandisk on my Nexus One for testing and it seems to be fine. I'd recommend using an external SD because it's replaceable and swap I/O will wear out your flash faster so you're better off segregating it.
I took a look at the state of the kernel source for the GTab7+ at the moment and it looks like the Samsung sources are out of date and a kernel built from the current sources won't run properly on the LA3 firmware (Garyd9 notes this in the thread for his kernel as well) so right now, building a custom kernel is a nonstarter for me because the LA3 firmware fixed some pretty major shutdown issues for me on my Tab.
Perhaps when the ICS sources are released, I'll take another look.

[Q] How to make Swap Partition For Galaxy Tab Plus

Hi
How can i create Swap Partition for increase RAM on Galaxy tab plus?
I find guide for other device, can`t find for Gt 6200
Thanks for help...
hmr007 said:
Hi
How can i create Swap Partition for increase RAM on Galaxy tab plus?
I find guide for other device, can`t find for Gt 6200
Thanks for help...
Click to expand...
Click to collapse
you can;t and should never need to.
You have 1 GB of RAM more than enough for any application.
Swap has not been used since Froyo I think . Since OG phones with 300 mb RAM.
Not used not needed
DigitalMD said:
you can;t and should never need to.
You have 1 GB of RAM more than enough for any application.
Swap has not been used since Froyo I think . Since OG phones with 300 mb RAM.
Not used not needed
Click to expand...
Click to collapse
Thanks for replay
but this 1GB (830 MB Actually) full after open 4-5 program or 2 game And Android close automatically other Application And last States!
I Want to save last States of other program Anyway until i Close program manually
For example Chrome close tabs after open 4-5 program and when i visit old tabs , it reloaded again!
hmr007 said:
Hi
How can i create Swap Partition for increase RAM on Galaxy tab plus?
I find guide for other device, can`t find for Gt 6200
Thanks for help...
Click to expand...
Click to collapse
Hi. Easiest way is to download Swapper2 from the PlayStore.
viper001 said:
Hi. Easiest way is to download Swapper2 from the PlayStore.
Click to expand...
Click to collapse
Only if you want to slow your tablet to a crawl.
Why would you want to swap very fast RAM with very slow SD memory? No need and a really bad idea.
DigitalMD said:
Only if you want to slow your tablet to a crawl.
Why would you want to swap very fast RAM with very slow SD memory? No need and a really bad idea.
Click to expand...
Click to collapse
agree. but, it looks like he's more concerned with multitasking.
it always depends on the user. let him try it first and let him decide what's acceptable for him.
Besides, "slow your tablet to a crawl" is an exaggeration.
viper001 said:
agree. but, it looks like he's more concerned with multitasking.
it always depends on the user. let him try it first and let him decide what's acceptable for him.
Besides, "slow your tablet to a crawl" is an exaggeration.
Click to expand...
Click to collapse
That won't help multitasking , Android already has an efficient memory management system. That OG swap app was for Froyo phones that only had about 300 mb to run the OS and apps. No longer applies. And since there are no true multi=tasking apps. IE you can;t run two foregrounds apps. ..... , you can never fill up RAM
DigitalMD said:
That won't help multitasking , Android already has an efficient memory management system. That OG swap app was for Froyo phones that only had about 300 mb to run the OS and apps. No longer applies. And since there are no true multi=tasking apps. IE you can;t run two foregrounds apps. ..... , you can never fill up RAM
Click to expand...
Click to collapse
OK. "Task-Switching" then .
Agree that android memory management is "efficient". the problem is that when it runs out of memory the app at the "back" of the stack gets "killed". data is saved for that app so when it's called back up, it "seems" like it was running all the while.
So, as per the OP question, since his problem was that his web pages keep reloading, ie app was killed due to memory constraints, his idea is to increase the RAM or in this case adding virtual RAM via swap.
It's not a bad Idea, since the amount of RAM is virtually increased, then the amount of apps that can be in RAM at the same time is also increased.
FYI, not only for froyo, i use swap for my NEO V running ICS. made DEAD SPACE run better than without swap. :good:
Haven't encountered a need on the P6200 though. Ofcourse, there must be a reason why 2GB RAM devices are now available.
there is not reason that swapping would make your tablet run better, none.
Because as of ICS , and with 1gb+ ram, you are emulating and interfering with what Android (linux) already does .
you have one foreground task and whatever idle tasks and then unused apps that are retained in RAM until they are needed or another apps needs space and they are removed from RAM. Then they reside on SD memory so what advantage does swapping to SD memory give you, none, in fact it adds a extra useless step .
SO Android attempts to keep RAM 80% used.at all times. If you look at the process logically, I do not believe can lay out a scenario by which the swapper apps beings any benefit to current Android systems.
DigitalMD said:
there is not reason that swapping would make your tablet run better, none.
Because as of ICS , and with 1gb+ ram, you are emulating and interfering with what Android (linux) already does .
you have one foreground task and whatever idle tasks and then unused apps that are retained in RAM until they are needed or another apps needs space and they are removed from RAM. Then they reside on SD memory so what advantage does swapping to SD memory give you, none, in fact it adds a extra useless step .
SO Android attempts to keep RAM 80% used.at all times. If you look at the process logically, I do not believe can lay out a scenario by which the swapper apps beings any benefit to current Android systems.
Click to expand...
Click to collapse
You actually pointed out the reason why the Original Poster wanted to use swap. he wanted his currently "unused" browser app to reside in ram, and not get killed. in this case it will be in virtual ram.
I agree with all your points. and I don't use swap on my tablet (P6200) haven't had a need, but i do use it on my phone(Neo V, 512 RAM, 384 useable).
All i'm saying is let him try. it's possible that he is hitting the limit on his Tablet. I know, cause it's easy to hit the limit on my phone that i'm very sure swapping works. e.g i can now switch between, Chrome, Facebook, Email, What'sUp, answer a phone call, send a text message and come back to Chrome (which has three open tabs BTW) without Chrome "reloading" those same three tabs. i wasn't able to do this before i starter using swap.
and yes, there's a bit lag but it's better than incurring cost of reloading a page each time, esp if your on a limited data plan.
One other thing that was not considered yet also are the OOM groups and Minfree. another option is Compcache.
The use of Swap really depends on the user and the way he uses his device. You can only see a benefit from swap if you consistently use up all your RAM. Which, if i understand the OP's problem correctly, is the case.

[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