[Q] Multiple SWAP !! - XPERIA X8 Q&A, Help & Troubleshooting

Hi,
I was looking for and answer, but i can find anything.
So i have 2 questions about swap.
1. Can i have multiple swap files? Like eg. Zram+other swap file? Or two swap files (one on /cache other on /sdcard). Made via 2 apps. One (on internal memory/sdext) would be working all the time, second (sscard) only if i had needed it.
2. Is it possible to lock app in swap? I mean that app should only work using swap - no real ram. I was thinking about music player or some widgets.

Romio.se4m said:
Hi,
I was looking for and answer, but i can find anything.
So i have 2 questions about swap.
1. Can i have multiple swap files? Like eg. Zram+other swap file? Or two swap files (one on /cache other on /sdcard).
Click to expand...
Click to collapse
I think it's possible to activate swap partition + swap file at once, but why you should do that?
You can create swap partition up to 4096 mb OR swap file up to 4096 mb using" ram expander" app from market.
-zram is ram compressor which slows down the device
Made via 2 apps. One (on internal memory/sdext) would be working all the time, second (sscard) only if i had needed it.
Click to expand...
Click to collapse
I didn't understand you, u wanna use internal memory as swap or install swapping app in internal?
(Cm9 roms use internal as swap partitions)
2. Is it possible to lock app in swap? I mean that app should only work using swap - no real ram. I was thinking about music player or some widgets.
Click to expand...
Click to collapse
I never heard something like locking app in swap but might be possible with some advanced RAM managers.
Sent From My BEAST , I mean X8

i guess u can have multiple swaps but you cannot have swap controlled by multiple apps.
kernel should find all swap places and should work according to them.
and u can increase swappiness to lock apps which are not active into swap.
but x8 internal memory is very slow.
our ram r/w speed is about 550MBps
and internal memory speed about 2mbps
so using swap other than zram is not really a good option.
also zram has disadvantages as it uses ram only and increases cpu overhead.

You can have any number of swap partitions or file that you like. Linux will do the job of distributing the swapped data to them and you can sit back and relax. Mind that only way this makes sense is if you got a fast enough sdcard.
Sent from my Galaxy Nexus using xda app-developers app

Related

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.

internal storage for swap

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)

[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

Swap

Is swap only usefull for gaming or it is also used when there a lot of apps running..
If the ram is totally used by the other apps and i open an app then will it run using swap or android system will kill the other app in background with least priority and make it run in the phone 's ram only...
In short is swap also usefull for multitasking...
IAmNice said:
Yes swap is useful for multitasking. It allows you to run 3-4 apps in the background. Consider swap if you have a fast sd card. If you open an app it will run in swap partion if your ram is full
Sent from my E15i using xda app-developers app
Click to expand...
Click to collapse
Man that's totally wrong! You obviously know nothing about how swap space works lol..
Swap partitions or files can be used like a ram buffer.. When ram gets full, the system can offload some data to the swap space, thus freeing some ram.
Apps NEVER EVER EVER run in swap space..
Using swap will drastically reduce the life of your sdcard. It is not advisable to use at all.
Uggh.. now I'm confused..
I just want to know that if the phones ram is full due to some apps running and i open a new app then wether it will run on swap or android system as it is architectured will kill the lowest priority app to free up space to run the new app launched in phone's ram..
Swap decrease sd cards life
bandarigoda123 said:
Swap decrease sd cards life
Click to expand...
Click to collapse
maybe you're right, but swap helped me a lot

Categories

Resources