Post Reply

[SWAP] Swap on Internal * v0.5 alpha *

OP impactor

1st February 2013, 03:38 PM   |  #1  
impactor's Avatar
OP Senior Member
Flag Montpellier
Thanks Meter: 76
 
669 posts
Join Date:Joined: Jan 2011
Donate to Me
More
SWAP on internal
Extend your RAM with very quick internal SWAP
v0.5 alpha



For the moment, the script is confirmed to work only on ROMs with the chinese x-part (or data2ext) by Atroy script only (read at the end of this post for alternative).
The only ROM I am aware of using this script out of the box is the excellent MIUI XJ x-part.
However, I intend to develop a non-loop based version shortly. It should will be compatible with most ROMs, so stay tuned.


What and Why
I decided to make a script that places the swap file on internal memory. Many people place it on SD card, but to me it seems somewhat pointless, as it hardly offers sufficient performance.
However, placing it on the internal memory makes it a much more interesting concept, because it has much better random read/write performance than even the fastest SD cards.


Warning: placing SWAP on internal memory will subject it to frequent read/write operations which in theory shortens lifespan of internal memory chip which you cannot replace. This is because flash memory has limited number of write/read cycles to it. So, consider yourself warned.


HOWEVER:
1 - although true, in reality I have been unable to find any case of this actually affecting anyone's phone. There is very limited amount of data documenting real-life effect of that process, but most likely your device will be long gone before the internal memory will show any signs of wear.
2 - the script recreates the swap file on each boot using different physical blocks of memory - this means not the same blocks are always used. More on this in 'Do it right' section.



Do It Right

1. 16-32 MB of swap should suffice. If you think you need more, you are probably wrong. NEVER use all available internal space. The larger the proportion difference between swap size and total free space on the internal data partition, the more breathing space your internal memory gets, as this allows the swap file to be moved around upon every reboot, which, in turn, will make it use the same blocks more rarely, and thus extending memory chip lifespan.

2. Get rid of bloat you don't use from the system partition, ie: ringtones, live wallpapers, useless system apps. Then create a custom
hboot with smaller system partition and larger data partition. You can do it using this (also attached to this post).

3. Play around with swappiness parameter. Still, the default set by the script should serve you well. But if you are paranoid, you can use it to further decrease how often system will write to swap.


Removal
Disable execution flag on the scipt in /system/etc/init.d and delete swap.img from internal data directory (on x-part scripts it is /mnt/asec/mtddata/ )



Quote:

v0.5 alpha
* first public release
* loop device version only


x-part Impacted script (80% chance of rendering your ROM unbootable)
I attached a data2ext script which should offer better performance and battery life than some other a2sd scripts.
You are free to try and flash it on your ROM, but there is a good chance it won't boot any more - this is a very alpha version and I am not working on it at the moment.
Do not post complaints about it here. I only want to hear from you if it works!
Last edited by impactor; 2nd February 2013 at 09:32 AM.
The Following 6 Users Say Thank You to impactor For This Useful Post: [ View ]
1st February 2013, 03:55 PM   |  #2  
abaaaabbbb63's Avatar
Recognized Contributor
Flag Somewhere Over The Rainbow
Thanks Meter: 3,037
 
3,795 posts
Join Date:Joined: Nov 2011
More
Re: [SWAP] Swap on Internal * v0.5 alpha *
So this allocates a part of your internal memory for random access? Nice.

I personally don't need more RAM, but this could be useful.
1st February 2013, 05:09 PM   |  #3  
Androidmarketuser's Avatar
Senior Member
Thanks Meter: 195
 
313 posts
Join Date:Joined: Oct 2010
This sounds really good to my ears
I will keep an eye on it.
Edit:
A small question:
So is it possible to use this for any rom if you are using data2ext for it?
Or atm only for miui xj?
Last edited by Androidmarketuser; 1st February 2013 at 05:13 PM.
1st February 2013, 05:56 PM   |  #4  
impactor's Avatar
OP Senior Member
Flag Montpellier
Thanks Meter: 76
 
669 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Quote:
Originally Posted by Androidmarketuser

A small question:
So is it possible to use this for any rom if you are using data2ext for it?
Or atm only for miui xj?

You have to use Atroy's data2ext, which is virtually impossible to obtain because it was developed as part of chinese MIUI rom and never released as a separate script.

However, I have been working on it and I am attaching an alpha version of my adaptation of this script to the first post
Let me know if it works, but there is a good chance your ROM will not boot any more.
The Following User Says Thank You to impactor For This Useful Post: [ View ]
1st February 2013, 07:21 PM   |  #5  
Androidmarketuser's Avatar
Senior Member
Thanks Meter: 195
 
313 posts
Join Date:Joined: Oct 2010
Quote:
Originally Posted by impactor

However, I have been working on it and I am attaching an alpha version of my adaptation of this script to the first post
Let me know if it works, but there is a good chance your ROM will not boot any more.

Thanks for your answer
I tried to install it on CM10 by vj but it didn't work. Here are my steps:
Wiped everything except sd
Installed rom, then data2ext script and finally the swap script.
I'm on a ext4 partition if it matters.
I think (not really sure) one script has created two folders: /data/ and /data-app/ on sdcard.
Or did I just install it the wrong way?

Edit: The problem was as you expected that it stucked at HTC bootlogo.
1st February 2013, 07:25 PM   |  #6  
impactor's Avatar
OP Senior Member
Flag Montpellier
Thanks Meter: 76
 
669 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Quote:
Originally Posted by Androidmarketuser

Edit: The problem was as you expected that it stucked at HTC bootlogo.

If you want to try x-part script, then do not flash swap script until you confirm the x-part rom works.
Try with some GB rom. Maybe you'll have more luck.
1st February 2013, 07:45 PM   |  #7  
Androidmarketuser's Avatar
Senior Member
Thanks Meter: 195
 
313 posts
Join Date:Joined: Oct 2010
Quote:
Originally Posted by impactor

If you want to try x-part script, then do not flash swap script until you confirm the x-part rom works.
Try with some GB rom. Maybe you'll have more luck.

I'll try it out that way on JB first (I am addicted to the new design, can't go back), if it doesn't work I will try it out with 2.3 anyway.

---------- Post added at 08:45 PM ---------- Previous post was at 08:31 PM ----------

Ok on JB the data2ext script doesn't seem to work, I can't boot.
I will try it out later with a GB rom, propably EuroSkank
1st February 2013, 10:10 PM   |  #8  
Androidmarketuser's Avatar
Senior Member
Thanks Meter: 195
 
313 posts
Join Date:Joined: Oct 2010
Hmm still doesn't work.
I tried MW7 on Redux2 but stucks at boot logo...
2nd February 2013, 02:35 AM   |  #9  
vasili_defy's Avatar
Senior Member
Flag Nasik
Thanks Meter: 63
 
397 posts
Join Date:Joined: Feb 2011
More
Re: [SWAP] Swap on Internal * v0.5 alpha *
Custom hboot maker link from thalasmus blog is dead!
Can someone plz attach it here!

Sent from my HTC Desire using xda app-developers app
2nd February 2013, 09:24 AM   |  #10  
impactor's Avatar
OP Senior Member
Flag Montpellier
Thanks Meter: 76
 
669 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Quote:
Originally Posted by vasili_defy

Custom hboot maker link from thalasmus blog is dead!
Can someone plz attach it here!

Attached.
Last edited by impactor; 2nd February 2013 at 09:27 AM.

The Following User Says Thank You to impactor For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Desire Android Development by ThreadRank