internal storage for swap - G1 Q&A, Help & Troubleshooting

Can't see that this has been asked already so I'll go ahead and be prepared to be flamed/ignored...
With apps2sd we don't seem to fill up our internal storage anymore so is it just being wasted? Would it have any benefit to use a bit of it for a swap file rather than have that going to the sdcard. I'm working on the assumption that the internal storage is faster than a class 6 but I may be wrong.

This is how we did it before everyone had swap partitions.. You can use a swap file on the internal memory but its slightly less efficient than a dedicated swap partition. There's really very little difference tbh.. Having the swap partition is just neater.

goldenarmZ said:
This is how we did it before everyone had swap partitions.. You can use a swap file on the internal memory but its slightly less efficient than a dedicated swap partition. There's really very little difference tbh.. Having the swap partition is just neater.
Click to expand...
Click to collapse
I see. Thanks for the reply. I find swap really bogs things down after a few days so I guess I'll continue to just use compcache (and wait for the desire to be released)

Related

[Q] ideal sd card settings?i

I would like to know if there is a consensus on the perfect partitons amounts and sizes. I have read that people are adding a third partititon for swapper. Does swapper even know to use this partition and if so how big should it be? Also I have an 8 gig class 6 that is set with a 3 gig fat32 and a 5 gig ext3. Is this set right or should I have less on the fat32?
i run 500 megs ext2 and the rest fat32 barley even touch filling my ext2 partition yet
WAAAAY too much on the EXT3. You really only need 1gb on the EXT3 partition because apps don't take up any space.
As for swapper I'm not really sure how big the partition needs to be, but swapper automatically locates the partition.
Thanks for the response. I am resizing and going with 500 mb for ext3 and 500 mb for the linux swap, although that is probably too much.
For SWAP use 32MB, setting it higher will put you into problems.

question about formatting and apps2sd

okay i just formatted my sd and i put 1g of memory on the swap and ex2, thats taking up 2g outa my 4g. does anything save on the swap? im just wondering this because i wanna free up as much memory as i can for saving pictures and music.
None of the roms out at the moment use the swap partition.. and the ext2 partition is for apps2sd.. I use 512 ext2 but no one needs that much. And swap you can set at 0 until the roms use it.
Hope this helps.
Redneck101 said:
okay i just formatted my sd and i put 1g of memory on the swap and ex2, thats taking up 2g outa my 4g. does anything save on the swap? im just wondering this because i wanna free up as much memory as i can for saving pictures and music.
Click to expand...
Click to collapse
You had no reason to change anything from the defaults. Go back and re-do it.
Redneck101 said:
okay i just formatted my sd and i put 1g of memory on the swap and ex2, thats taking up 2g outa my 4g. does anything save on the swap? im just wondering this because i wanna free up as much memory as i can for saving pictures and music.
Click to expand...
Click to collapse
Swap file will not be usable until we get Source code for the kernel. SWAP = Linux version of a page file. = Hard Drive based RAM. Kind useless on a phone. I doubt it will make leaps and bounds of difference when we actually get it. You can set swap to 0 and apps to 512. If you use more than 512 for apps, you are a pack rat and probably cant find anything and don't use what you have IMHO.
Kcarpenter said:
Swap file will not be usable until we get Source code for the kernel.
Click to expand...
Click to collapse
Uh. no. Swap works now. There's even an application on the market that will set it up for you, as long as you have the swap partition on your sdcard. Allows you to enable and disable it, and so on. It's not hard to set it up, then adb into the phone and verify it's actually doing something.
SWAP = Linux version of a page file. = Hard Drive based RAM.
Click to expand...
Click to collapse
No, not really. Swap is not additive to your real RAM.
Kind useless on a phone. I doubt it will make leaps and bounds of difference when we actually get it.
Click to expand...
Click to collapse
Depends. Having swap enhances memory management, as it allows you to page stuff out of *real* RAM when it's not in use, and only bring it back when a page fault forces you to. It can also really beat you up, if memory pressure is forcing so many faults that the kernel spends all its time moving memory around instead of allowing processes to actually run.
You can set swap to 0 and apps to 512. If you use more than 512 for apps, you are a pack rat and probably cant find anything and don't use what you have IMHO.
Click to expand...
Click to collapse
Additionally, even applications installed to the sdcard use SOME space in /data. You'll overrun the filesystem in the phone before you overrun a 512 mb partition.

Using NAND as RAM?

After many tests I think that we really suffer from a lack of RAM. But the internal memory (NAND) should be the same speed as RAM I think. So why we don't use another 128Mb of NAND as additional RAM? A sort of swap part, but used as RAM and not as normal swap....
If someone related to the kernel would answer is it possible or not, it would be good)
DiMiK said:
After many tests I think that we really suffer from a lack of RAM. But the internal memory (NAND) should be the same speed as RAM I think. So why we don't use another 128Mb of NAND as additional RAM? A sort of swap part, but used as RAM and not as normal swap....
If someone related to the kernel would answer is it possible or not, it would be good)
Click to expand...
Click to collapse
Using it as RAM would propably require major changes to the kernel if it is even possible which I doubt it is. Using it as swap would be the possible alternative and I pretty sure that is very possible and would help performance but at a cost.
1. You would either have very little left for system and data or you would have to put system and/or data on the SD-card and that alone may make you lose anything you gain from putting swap on NAND.
2. I actually asked the swap-on nand question myself and well, we can't replace our NAND, at least not easily and swap is I/O intensive and intesive I/O will sooner or later wear out the NAND. So basicly this is not a good alternative unless you want to turn your phone into a paperweight sooner than you had planned.
So what we can do is using compcache and/or swap on SD-card. The easiest thing is to just enable some compcache. It uses RAM as swap and uses compression on the contents so we can hold more things in RAM that we would usually be able to. This means Android can keep more apps in "sleep" allowing for faster switching between apps but it will also decrease the possible amount of available RAM for the active app. I usually turn on compcache with the default setting which is to use 25% of the RAM for compressed swap. It might be placebo but IMHO it feels a it "smoother" to use after that.
Another alternative is to use a swap partition in the sdcard. Just using swap means you do not need to load any compcache kernel modules and there is no compression taking place so it's a good alterantive. However you need know your way around partitioning SD-cards to get this running so it's not as easy as just enabling compcache (assuming the build supports compcache).
For the really advanced you can enable compcache with backing swap. It means it uses a certain amount of compressed swap i RAM and when it runs out of space there it starts putting stuff on the SD-card swap partition. Once again, a bit tricky to setup but may be the best alternative.
Read more about it here: http://wiki.cyanogenmod.com/index.php/Compcache
kallt_kaffe said:
I usually turn on compcache with the default setting which is to use 25% of the RAM for compressed swap. It might be placebo but IMHO it feels a it "smoother" to use after that.
Click to expand...
Click to collapse
It make good effect: more applications can run simultaneously.

[Q]most great set for SDCard

Just simply question guys,but I confuse about this
*swap enable/using swap partition
*using ext partition over moving apps2SD normally
Is this could be better than normal/standard SDCard?
I have Transcend 16GB Class 10 using fat32+ext4 (using link2sd)
But I felt not different with my VGen Class4 8GB
Please guys if you have experience about this,,tell whats wrong n what were I missed for
Thanks
Sent from my Spice Mi-410 using Tapatalk 2
Arya_3RDNumber said:
Just simply question guys,but I confuse about this
*swap enable/using swap partition
*using ext partition over moving apps2SD normally
Is this could be better than normal/standard SDCard?
I have Transcend 16GB Class 10 using fat32+ext4 (using link2sd)
But I felt not different with my VGen Class4 8GB
Please guys if you have experience about this,,tell whats wrong n what were I missed for
Thanks
Sent from my Spice Mi-410 using Tapatalk 2
Click to expand...
Click to collapse
I'll try to answer base from what I know....
"*swap enable/using swap partition"
About this, we have to know what is swap, swap type and do we need it?
swap is the another partition which will be used as an extra memory. As we know, memory is been accessed VERY OFTEN in a process, both read and write.
On linux PC commonly we use one partition on disk drive for linux swap. On windows it's using a file as a virtual memory.
Swap is needed when the application need large memory to be used for a process and the current ram is not enough. Well there are some priority list to be followed. Ok, I'll give an example if we run a big game in an android. we have ~350MB total user memory but let say we have 50MB free memory. Most of android BIG 3D games will not exceed 300MB of memory, the game designer will look to target phone which will run it, and they presume all user don't have swap memory. But let say the app will need about 300MB of memory to run.
1. If we have 50 MB swap partition in sdcard
Android will never deplete the real ram, so let say it will keep 10MB of free ram, it will be use for the android system rom to keep running. In this situation the app will take 40MB of free ram, 50MB of swap... and what about another 210MB? Android will take it from the real ram by kill another apps (based on priority of low memory killer setting) to reallocate the ram. So for the game, the real ram will be taken about 250MB and 50MB from swap and free ram about 10MB. another 90MB of real ram used by the system and another hidden app like framework setting, messaging and others and for app cache. About 250MB ram used by game app is accessed very fast, but 50MB of swap if very slow because of access speed of sdcard is very much slower then ram.
When exiting from the game, some hidden apps still in memory. Android will run one or two another residen apps.
2. If we have 50 MB swap zram
Zram is swap partition in real ram, not sdcard. Any data written to the zram is compressed and decompressed on the fly. For 50MB zram, let say we can get about 80MB swap because of compression. the ratio depend on data been compressed.
Just like said in point 1, android will keep 10MB of free ram for the android system rom to keep running. The app will take 40MB of free ram, 80MB of swap. The real ram is 350MB - 50MB(zram) = 300MB, 290MB will be available for apps. The app will take 80MB from zram, and use 220MB from real ram. So 290 - 220 = 70MB of ram will used by android system and for app cache.
About speed of game between those 2 swap type, zram will be faster for sure because it use ram rather then sdcard. And one thing I feel necessary to let you know. Not as in PC which using HDD as storage which almost has unlimited write cycle. But we use SDCARD which has very limited write cycle. So consider using swap partition in your sdcard, even if it has very fast write/read speed. It will significantly affect your sdcard life.
When exited from the game, few hidden app still reside in memory. Android will run few another residen apps.
3. If we not use any swap
The game will take 300MB of ram, and let 40MB of ram used by android system. More apps have to be killed by android low memory killer system.
When exited from the game, only one or two hidden app still reside in memory. Android will run some more another residen apps.
It's your decision to use swap or not. The need is depend on your behave of use of this phone and the types of apps installed, such as more widgets, tools and some residen apps. Try every option, and you will get the result. The result could be different with another user, depend on behave and the apps installed.
*using ext partition over moving apps2SD normally
If you really have your internal storage depleted, let say you have installed hundreds of apps, then yes you will need app2SD or ext partition on sdcard.
The read and write speed of internal storage and sdcard will definitely win by internal storage (You have class 10 of sdcard? just test the write speed of internal storage).
ext partition is access directly while app2SD using 3rd app, so using ext partition should be faster then app2SD.
Just 1.5 cents....
Do you understand what I've talked about???? Well.... I don't!!!
I'm a noob and it cracks my skull. Great explanation though:good:
wow??!! great explanation agan master
well I understand very much after read 1000times
Thanks a lot gan,,I must little experiment to realize
Now I understand what is "ZRAM" (sorry I really noobie )
about all this case,,is ZIPALIGN also complicate?
Well... actually my explanation hasn't completed yet. I was mentioned about priority, I didn't explained it. It about low memory killer configuration and also the priority of using swap. You can Google that .
About zipalign, it related with apk files. It intended to make it faster to load. Apk file is a compressed file. But I don't have any further knowledge regarding this. May be someone can explain it.
Sent from my bike using Tapatalk 2

What is meant by swap space?

Can anyone help me find, what is actually swap space means??
Swap space is a reserved space on a harddrive that acts as a "extended" RAM. When the RAM memory is full the kernel move stuff from the RAM memory to the Swap partition to free up memory. The data is later stored in the Swap until it's needed again.
The same thing or similar at least on a Windows pc is pagefile.
There are some discussions if swap files should be used or not on flash based storage devices since it increase the read/write cycles to the storage device and there by would break it faster (since flash based storage devices have a maximum of read/write cycles).
lintz said:
Swap space is a reserved space on a harddrive that acts as a "extended" RAM. When the RAM memory is full the kernel move stuff from the RAM memory to the Swap partition to free up memory. The data is later stored in the Swap until it's needed again.
The same thing or similar at least on a Windows pc is pagefile.
There are some discussions if swap files should be used or not on flash based storage devices since it increase the read/write cycles to the storage device and there by would break it faster (since flash based storage devices have a maximum of read/write cycles).
Click to expand...
Click to collapse
wow..thats a good piece of information.thanks mate +1
W/O swap
When low memory occurs kernel kill processes
With Swap
Kernel move those about to be killed process to swap space and then map them pointer with RAM so when you open that app instead of allocating new memory to psycial RAM its been read from Swap and loaded to RAM.
As mentioned many times creating swap file and/or swap partition to flash drive aka our phone memory(internal storage) is not a wise choice cause recursive read and write can damage that nodes in longer run as flash memory has limited read/write cycles.
Other choice is to make swapfile and/or partition to external mmc but as external mmmc has which could also damage mmc in longer run but it could be replaced cheap rather than internal flash memory. Issue arises with external c swapfile and/or partition is slower read and write which could degrade performance
So one for-all if swap is needed than CompCache/Zram is a wise choice which uses physical reserved RAM portion for swap. Which uses extemsive CPU to compress data and write them to swap and retrive them by decompressing and writing back to physical RAM. Which is not harmful but can use more battery and obviously its faster than swap on external mmc. Usually its faster in the beginning and slight laggy after more hours and days usage
Sent from my LG-P990 using Tapatalk 2
spica1234 said:
W/O swap
When low memory occurs kernel kill processes
With Swap
Kernel move those about to be killed process to swap space and then map them pointer with RAM so when you open that app instead of allocating new memory to psycial RAM its been read from Swap and loaded to RAM.
As mentioned many times creating swap file and/or swap partition to flash drive aka our phone memory(internal storage) is not a wise choice cause recursive read and write can damage that nodes in longer run as flash memory has limited read/write cycles.
Other choice is to make swapfile and/or partition to external mmc but as external mmmc has which could also damage mmc in longer run but it could be replaced cheap rather than internal flash memory. Issue arises with external c swapfile and/or partition is slower read and write which could degrade performance
So one for-all if swap is needed than CompCache/Zram is a wise choice which uses physical reserved RAM portion for swap. Which uses extemsive CPU to compress data and write them to swap and retrive them by decompressing and writing back to physical RAM. Which is not harmful but can use more battery and obviously its faster than swap on external mmc. Usually its faster in the beginning and slight laggy after more hours and days usage
Sent from my LG-P990 using Tapatalk 2
Click to expand...
Click to collapse
yh...this is actually what Iam looking for..thank you Spica it helped me a lot...So which is more harm less? swapfile,ZRam or CompCache?
basimsherif3 said:
yh...this is actually what Iam looking for..thank you Spica it helped me a lot...So which is more harm less? swapfile,ZRam or CompCache?
Click to expand...
Click to collapse
Compcache or zram which is fastest amongst swap
Sent from my LG-P990 using Tapatalk 2
So in cm7, if compcache/zram is disabled, will it use swap?
aldyu said:
So in cm7, if compcache/zram is disabled, will it use swap?
Click to expand...
Click to collapse
No untill and unless you have created swapfile and/or partition with an init.d startup script
Sent from my LG-P990 using Tapatalk 2

Categories

Resources