[DEV-HINT] Implementing a swap partition or swap file for new and old bootloader - LG Optimus 2x

[DEV-HINT] Implementing a swap partition or swap file for new and old bootloader
Wikipedia defines swap file (or paging) as: "[..] use disk storage for data that does not fit into physical random-access memory (RAM)."
With CM10 or CM10.1 around, the 'about phone' screen usually shows 343 MB of usable RAM on the LG-P990, so one gets ideas. With CM9 it was a bit better, but still.... Take Chrome for example: nice to the eye, but not so nice to the RAM of devices that have been around a lot longer than the Nexus 4 with its whopping two Gigabytes. So what's the catch with swap? For example, a HDD swap partition on a PC offers some sort of relief when RAM is scarce by moving some parts of the RAM (pages) to the HDD and moving them back when it needs it. Of course, it comes for a price: performance! But it works. So why not using it on Android too? To hell with the fact that virtual RAM on the internal memory card is a lot slower than physical RAM, there are times when it would be just nice to have the extra megabytes at hand.
Were you a bit envious too when you saw that the 'new' partition layout that came with the ICS bootloader on our beloved LG-P990 had a swap partition included? Well, I was. I even changed to a customized layout to get one for a little while too... But that is not really necessary. Never was, actually. I came back to the original layout and old bootloader weeks ago. What still bugged me was the missing swap partition. CM10.1, CM10 or even CM9 could really use swap from time to time but commonly don't use it.
So, is there really a big difference between the two partition layouts? Yes, but regarding the swap it doesn't count. In fact, the situation for both user groups is pretty much the same: both do not use any kind of swap space whatsoever. First, there are the users with the new bootloader. They have the swap partition but actually don't make use of it. As compared with users with the old bootloader: they may not have the swap partition on their partition table but even they can easily implement a solution very similar to a standard swap partition: a swap file. Then they can benefit as well from some extra Megabytes in certain low memory situations. You don't have a swap partition/file in use yourself yet? In just a few minutes you can change that no matter what bootloader you have.
First you have to find out which bootloader/partition layout is on your LG-P990:
here is how you determine your bootloader/partition layout: reboot!
If you see a pink LG logo when the phone boots then you have the new bootloader/new partition layout (ICS)
If you see a white LG logo when the phone boots then you have the old bootloader / old partition layout(GB)
All commands used in the terminal are shown with a '$'-sign or '#'-sign (root). Copy just the commands without the signs to the terminal, unless stated otherwise.
New bootloader/partition layout (ICS) - Pink LG logo as splash screen - You have the old bootloader/partition layout? Skip to the second part below.
If you are using the new partition layout, then it is easy to use the swap mechanism. The 350MB swap partition is just waiting for you to be switched on.
Use 'adb shell' or the terminal:
check the situation with
Code:
$ free
Does it show 0 0 0 in the swap line? Then swap is not working at the moment and has to be switched on.
Use
Code:
$ su
to get superuser rights
Make the swap partition usable (Be extra careful! Triple-check the command!)
Code:
# mkswap /dev/block/mmcblk0p4
Switch it on
Code:
# swapon /dev/block/mmcblk0p4
Change swappiness to zero at runtime
Code:
# sysctl -w vm.swappiness=0
To keep the swap partition switched on, after reboot and even after flashing ROM updates
create the file /data/local/userinit.sh
Put these lines inside (with the '#' sign)
Code:
#!/system/bin/sh
swapon /dev/block/mmcblk0p4
sysctl -w vm.swappiness=0
swappiness=0 lets the kernel use the swap partition only when there is no more physical RAM left.
Save the file.
Now reboot.
Check it via adb shell or terminal if it is working.
Code:
$ free
The swap line should show that 350 MB are available (total/free).
Check the swappiness with
Code:
$ cat /proc/sys/vm/swappiness
It should show 0 now.
Testdrive your work. Start Chrome or a game or whatever uses a lot of RAM on your system. Use it heavily and then check the swap usage of your kernel again with a final
Code:
$ free
Just try it!
Old bootloader/partition layout (GB) - White LG logo as splash-screen
The task is to create a 128 MB Swap-File on the data partition. 128 MB seems enough since it is just for memory emergencies. And it's best to create it on the data partition and not on the sdcard because of the USB mass-storage support that would interfere with any swap file on sdcards. By the way, it doesn't format your data partition. It just makes your usable space of the data partition 128 MB smaller than it is right now. Basically, it creates an empty file with the fixed size of 128 MB and makes it usable as a swap 'partition'. It has the same functionality as a swap partition. And the same speed. And everything else. It just doesn't reside in its own partition. It is even better: when you don't want it anymore or change the size of it, just stop the swap-file with 'swapoff' and delete the file 'swapfile' in your data partition and it's gone for good. Immediately you can use the freed-up space for something else.
Use 'adb shell' or the terminal:
check the situation with
Code:
$ free
Does it show 0 0 0 in the swap line? Then it is not working at the moment and has to be switched on.
See with
Code:
$ df
whether there is enough free space left on /data. 200 MB or more should be free on /data. 128 MB will be used.
Get superuser rights
Code:
$ su
Optional: To see more interesting memory stats you can use
Code:
# cat /proc/meminfo
Now create the file named 'swapfile' with the size of 128 MB
Code:
# dd if=/dev/zero of=/data/swapfile bs=1024 count=128000
This can take a moment.
Limit the rights of the swapfile
Code:
# chmod 600 /data/swapfile
now set up the swapfile for swap usage
Code:
# mkswap /data/swapfile
Switch it on
Code:
# swapon /data/swapfile
Hint: switch off would be swapoff /data/swapfile
Now it is already working!
Tune it to your needs: we just want the swap file to be used in emergencies when there is no RAM left anymore and Android would turn Project Butter in Project Stutter.
Check the status of swappiness
Code:
# cat /proc/sys/vm/swappiness
Default is 60. That is much too high. swappiness=0 lets the kernel use the swap file only when there is no more physical RAM left.
Change it to zero
Code:
# sysctl -w vm.swappiness=0
With this sysctl command you can change the swappiness setting (0-100) on runtime.
If you want to make these settings permanent no matter if you reboot or even flash a ROM update without wiping data then
create the file /data/local/userinit.sh
Put these lines inside (with the '#' sign)
Code:
#!/system/bin/sh
swapon /data/swapfile
sysctl -w vm.swappiness=0
Save it.
Reboot and check it with a last
Code:
# free
in terminal. Now testdrive your swap file with two browsers and a game simultanously or whatever suits your needs to stress your P990.
Just try it yourself!
Have fun!

and another awesome dev thread by Raum1807 :good:
Interested in making a flashable zip out of it? If not I could do it next week.
Just adding everything into one sh-file which gets called by the updater-script - or just via the Terminal.

tonyp said:
and another awesome dev thread by Raum1807 :good:
Interested in making a flashable zip out of it? If not I could do it next week.
Just adding everything into one sh-file which gets called by the updater-script - or just via the Terminal.
Click to expand...
Click to collapse
Thanks for the offer. Thought about that, too. But I think it is more interesting to understand what we are doing here by following it step-by-step. A script makes it too easy... Maybe later, we will see.

sorry for this dumb question.
what's the difference between using this method and using roehsoft ram expander?
both of them have the option to change swappiness and to enable/disable swap from sdcard (roehsoft ram expander can even choose ext sd as swap location)
i don't get it :silly:

old bootloader:
/data/swapfile # that's internal sd right?
wouldn't it be better to use external sd for swapping as swapping heavily might in the long run kill a flash drive?

derEremit said:
old bootloader:
/data/swapfile # that's internal sd right?
wouldn't it be better to use external sd for swapping as swapping heavily might in the long run kill a flash drive?
Click to expand...
Click to collapse
i don't think so, AFAIK the max reading speed for ext sd is 10 MBps, which is lower than reading speed in our int sd (about 13 MBps). that's why using int one for swapping would be a better choice
please CMIIW, i'm still noobs in this kind of stuff. though, i just want to share what i know

I have one point to this.
You write "swappiness=0 lets the kernel use the swap partition only when there is no more physical RAM left."
But there is every time some free space on RAM, because android never let decrease memory to zero.

babi_perang said:
sorry for this dumb question.
what's the difference between using this method and using roehsoft ram expander?
both of them have the option to change swappiness and to enable/disable swap from sdcard (roehsoft ram expander can even choose ext sd as swap location)
i don't get it :silly:
Click to expand...
Click to collapse
- Doesn't use the external sdcard
- Doesn't cost 7 Euro
- gives you an idea how things work
Sent from my LG-P990 using xda app-developers app

derEremit said:
old bootloader:
/data/swapfile # that's internal sd right?
wouldn't it be better to use external sd for swapping as swapping heavily might in the long run kill a flash drive?
Click to expand...
Click to collapse
Swapping is only happening when the RAM is critically low. Btw, the swap partition of the ICS partition layout is also located on the internal memory. No difference so to speak. Using this method shouldn't harm the internal memory at all.
Sent from my LG-P990 using xda app-developers app

tomsi91 said:
I have one point to this.
You write "swappiness=0 lets the kernel use the swap partition only when there is no more physical RAM left."
But there is every time some free space on RAM, because android never let decrease memory to zero.
Click to expand...
Click to collapse
Yes, the memory management of Android tries to keep the RAM clean while keeping the last few opened apps in the RAM. Four or five running CM10.x on the P990. But the less RAM you have on your phone the harder this balance gets. Imagine memory eating apps like Gallery/Camera or Chrome. They benefit from more memory being available.
Sent from my LG-P990 using xda app-developers app

Thank you for this helpful guide! It is so easy to make it. And now I know a bit much more about Android and RAM.
Gesendet von meinem LGP990 mit CM10.

Hey! This seems interesting but i have a question , before doing this we have 343 RAM available and after all this trouble only 350 ? so thats 7more RAM or am i missing something ?

Soare23 said:
Hey! This seems interesting but i have a question , before doing this we have 343 RAM available and after all this trouble only 350 ? so thats 7more RAM or am i missing something ?
Click to expand...
Click to collapse
Yes, you forgot to read the original post that explains what exactly swap is:
So what's the catch with swap? For example, a HDD swap partition on a PC offers some sort of relief when RAM is scarce by moving some parts of the RAM (pages) to the HDD and moving them back when it needs it. Of course, it comes for a price: performance! But it works. So why not using it on Android too? To hell with the fact that virtual RAM on the internal memory card is a lot slower than physical RAM, there are times when it would be just nice to have the extra megabytes at hand.
Click to expand...
Click to collapse
The reported RAM will remail the same because you aren't increasing your physical RAM.

When i try to creat a swap file, this Error appears:
/def/zero/: canot open for read: Not directory
I'm a superuser
---------- Post added at 09:20 PM ---------- Previous post was at 09:13 PM ----------
After disconnecting from computer it worked!

Swappiness=0 doesn't stick for me after reboot It returns to 60 everytime.

@Raum1807
Awesome thread. Thanks for kindly explaining everything. I learned a lot here!

Ajsh said:
Swappiness=0 doesn't stick for me after reboot It returns to 60 everytime.
Click to expand...
Click to collapse
just put:
echo "0" > /proc/sys/vm/swappiness
at the end of a .sh file in init.d

As we´re talking about using the wasted Swap-Partition:
Is it possible to use it as a "new" kind of Ramhack?
As for now we cut off some shared Ram of GPU to use it as normal RAM. What if we let the GPU use the Swap-Partition as its Memory and get all physical RAM available?
GPU will not perform as good as now, but some People don´t need a Phone to play Games...
Is this possible or restricted to some Nvidia-Libs that are Closed-Source??

zerocoolriddler said:
As we´re talking about using the wasted Swap-Partition:
Is it possible to use it as a "new" kind of Ramhack?
As for now we cut off some shared Ram of GPU to use it as normal RAM. What if we let the GPU use the Swap-Partition as its Memory and get all physical RAM available?
GPU will not perform as good as now, but some People don´t need a Phone to play Games...
Is this possible or restricted to some Nvidia-Libs that are Closed-Source??
Click to expand...
Click to collapse
This is interesting... it could really make a difference , only if it works tho heh.
Sent from my LG-P990 using xda app-developers app

Can we have both Swap and Zram on in CM 10 ? Any possible side effects

Related

Linux-swap Cynanogen?

ok so i made a linux-swap partion on my sd card that is 64mb. Now do i need to activate it somehow? or does cynogen do it for me? i tried to search but couldnt find. also do i need update my radio? it is 2.22.19.26I
You need user.conf and userinit.sh files on your ext partition. There's a guide on how to set that up here.
ok and can i have compcache and linux-swap at the same time? or do they do the same thing? also do i need to make a partion for compcache? and i cant find the htc keyboard in 4.2.3.1, does it come with it?
i thought if you have 4.2.3.1 you didnt have to add the files as it does everything for you? am I missing something.
is compcache and linux swap the same thing? and do we need both?
nahanee20 said:
is compcache and linux swap the same thing? and do we need both?
Click to expand...
Click to collapse
lol, no.
Swap is virtual memory. It uses a seperate partition to act as extra RAM, but it's nowhere near comparable to real RAM.
Compcache compresses what's in the RAM, so there's more space to cram files in. The problem is constantly compressing and decompressing files in RAM puts a heavy strain on the CPU.
so do i need to put the usernit files on or did this rom already do it?
does anyone know how to use the user.config app to do this?
nahanee20 said:
does anyone know how to use the user.config app to do this?
Click to expand...
Click to collapse
You DO NOT have to add any user int files to your sd for swap to work.
Its already rolling if you installed correctly.
go to terminal and use the print command to view your allocated spaces for each ext
Better yet, use the "free" command to see if it is really being used. I am pretty sure Cynanogen does not use a swap partition by default. It needs to be enabled. A easy way to check and setup your swap it to download swapper.
When I type free in the terminal I see 0 for total, used and free swap. I made an ext4 and a 32mb swap partition on my sd card. How do I enable swap on Cyanogen 4.2.5?
beav_35 said:
When I type free in the terminal I see 0 for total, used and free swap. I made an ext4 and a 32mb swap partition on my sd card. How do I enable swap on Cyanogen 4.2.5?
Click to expand...
Click to collapse
search user.conf app on market

[HOWTO] Create large files empty files ?

Hi,
is it possible to tell dd to create a swap-file at a specified cluster ?
If not, did anyone know if there is an Android-tool, wich allocates Diskspace on FAT32 without actually writing data to a file ?
I`ve tried dd with the seek Option, but this wont work on FAT.
Thx in advance
Thom
TheGenesis said:
Hi,
is it possible to tell dd to create a swap-file at a specified cluster ?
If not, did anyone know if there is an Android-tool, wich allocates Diskspace on FAT32 without actually writing data to a file ?
I`ve tried dd with the seek Option, but this wont work on FAT.
Thx in advance
Thom
Click to expand...
Click to collapse
An empty file would be a file full of zeros (?)
also
has anybody tried to put a swap-file in /data partition yet? Should be way faster...
Wrong sect btw
I'm not sure if this is what you mean but
"dd if/dev/zero of=/sdcard/swapfile bs=1024 count=524288"
This command will tell dd to create output file with the size of 512MB full of zeros.
Then you run "mkswap /sdcard/swapfile" in order to create the swap file-system on the output file
Finaly you run "swapon /sdcard/swapfile" in order to make the swap avaialbe to the kernel.
This is how it goes on RH, I belive it will work the same on Android as well.
and I'm sorry if this isn't what you meant.
zrubi said:
I'm not sure if this is what you mean but
"dd if/dev/zero of=/sdcard/swapfile bs=1024 count=524288"
This command will tell dd to create output file with the size of 512MB full of zeros.
Then you run "mkswap /sdcard/swapfile" in order to create the swap file-system on the output file
Finaly you run "swapon /sdcard/swapfile" in order to make the swap avaialbe to the kernel.
This is how it goes on RH, I belive it will work the same on Android as well.
and I'm sorry if this isn't what you meant.
Click to expand...
Click to collapse
yeap, it works on Android
bs=1024k count=512 makes the maths easier
you could put it on data BUT I wouldn't advise it, its going to limit the life of the mtd, an SD card is much cheaper to replace
Thx for the replies.
No, I dont want a file full of 0x00 ... I need a way to force the physical position of the swap-file.
I have tried dd with the seek option wich allocates space without writing to the file. But it doenst work on a fat partition (resulting to a file full of zeroes).
Any Idea how to force the creation of a file starting at a specified cluster (or a near by position) ?
Thom
TheGenesis said:
Thx for the replies.
No, I dont want a file full of 0x00 ... I need a way to force the physical position of the swap-file.
I have tried dd with the seek option wich allocates space without writing to the file. But it doenst work on a fat partition (resulting to a file full of zeroes).
Any Idea how to force the creation of a file starting at a specified cluster (or a near by position) ?
Thom
Click to expand...
Click to collapse
can I ask why you want to specify the cluster?
why do you need your swapfile to be in a certain place?
I want simulate wear-leveling on the free space of my FAT32-Partition to dramaticly extend the lifetime of my sdcard.
I have done some forensics on how dd reallocates free clusters and find out, that it preferable uses the space at the begin of the partition.
Currently I build "rotating" swap-files (names) every boot/reswap until free space is completely used. Then I delete all old swap-files so the next file will be created again at the begin of the partition.
I have about 10GB space left, so I would reach about Factor 70 of the "unknown" lifetime of my sdcard.
This is working but not very handy, because I have to delete old swap files if I need free space when the "wear space" is getting "full".
If I could force the start position of the swap file (probably by allocating only the FAT entries) I wont need these temp files permanently blocking the free space.
Anyy Idea ?
TheGenesis said:
I want simulate wear-leveling on the free space of my FAT32-Partition to dramaticly extend the lifetime of my sdcard.
I have done some forensics on how dd reallocates free clusters and find out, that it preferable uses the space at the begin of the partition.
Currently I build "rotating" swap-files (names) every boot/reswap until free space is completely used. Then I delete all old swap-files so the next file will be created again at the begin of the partition.
I have about 10GB space left, so I would reach about Factor 70 of the "unknown" lifetime of my sdcard.
This is working but not very handy, because I have to delete old swap files if I need free space when the "wear space" is getting "full".
If I could force the start position of the swap file (probably by allocating only the FAT entries) I wont need these temp files permanently blocking the free space.
Anyy Idea ?
Click to expand...
Click to collapse
ahh, I see now
tbh I thought wear-leveling was handled in firmware
Edit : nope, now I think about it I'm might getting it mixed up with SSD firmware
You are wasting your time. The SDCARD already does its own wear leveling.
I dont think so ... wear-levelling is integrated in the "drive"-electronic of modern usb-sticks and in solid-disk-drives (some communicating to the os at driver level).
I have not found any confirmation, that micro-sdcards own native wear-levelling. The customer support of A-Data did not respond to inquiries to this topic.
Do you have any reference, that confirms that wear-levelling is supported natively by any MICRO-sdcard ?
Regards
Thom
TheGenesis said:
I dont think so ... wear-levelling is integrated in the "drive"-electronic of modern usb-sticks and in solid-disk-drives (some communicating to the os at driver level).
I have not found any confirmation, that micro-sdcards own native wear-levelling. The customer support of A-Data did not respond to inquiries to this topic.
Do you have any reference, that confirms that wear-levelling is supported natively by any MICRO-sdcard ?
Regards
Thom
Click to expand...
Click to collapse
http://www.cs.ucr.edu/~amitra/sdcard/ProdManualSDCardv1.9.pdf

How to SWAP for tattoo

Warning : It can (and will) shorten SD or NAND lifespan.
A little tutorial for those who want to try swap on their tattoo without decreasing the life of their sd card.
Download the file attached here, or here.
And then do this :
Code:
adb shell "mkdir /data/swap"
adb push swapfile.swp /data/swap
adb shell
mkswap /data/swap/swapfile.swp
losetup /dev/block/loop0 /data/swap/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
If you want to use it on the SD :
Code:
adb push swapfile.swp /sdcard/
adb shell
mkswap /sdcard/swapfile.swp
losetup /dev/block/loop0 /sdcard/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
Keep in mind you must do losetup and swapon after each reboot.
Have been testing it for a while. No problems till now and delivers a very noticeable speed increase.
Thank you very much igstoian.
I'm gonna use it in my ROM if you don't mind.
Great that I can help.
Also post your experience with it. How is the speed gain?
Maybe this is a dumb question, but is it possible to enable swap even if my phone does not have custom boot.img??
I've rooted it, but not permanently (after a reboot I have to run the exploit again and I don't want to take the risk to brick it).
/Edit: WTF?! It's blazing fast Thank you!
Then you have to run the exploit and enable swap on every reboot if you want it...
You are actually using the data partitions for swap? And you think that increases SD card life? Sure it does, but what about the NAND flash that our data partition is, and has poorer life anyway than the damn 10 buck SDcard!?
eyegor said:
You are actually using the data partitions for swap? And you think that increases SD card life? Sure it does, but what about the NAND flash that our data partition is, and has poorer life anyway than the damn 10 buck SDcard!?
Click to expand...
Click to collapse
right
guess it's still too hard to change internal storages
It would be better to use a swap partition? A file is not the same as a partition.
Testing, swap file in system memory:
-a full day of use, the swap is 3 mb.
-30 programs loading into memory, the swap is less than 4 mb of use.
The use made is at least equal to a partition could increase. Or helping the compcache (I haven´t compcache)
It doesnt matter if its a file or a partition. you write files to a partition or you write info to a file. its still writing and its the read-write cycles that damages memory, not the amount of files being written.
lgstoian said:
Warning : It can (and will) shorten SD or NAND lifespan.
A little tutorial for those who want to try swap on their tattoo without decreasing the life of their sd card.
Download the file attached here, or here.
And then do this :
Code:
adb shell "mkdir /data/swap"
adb push swapfile.swp /data/swap
adb shell
mkswap /data/swap/swapfile.swp
losetup /dev/block/loop0 /data/swap/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
If you want to use it on the SD :
Code:
adb push swapfile.swp /sdcard/
adb shell
mkswap /sdcard/swapfile.swp
losetup /dev/block/loop0 /sdcard/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
Keep in mind you must do losetup and swapon after each reboot.
Have been testing it for a while. No problems till now and delivers a very noticeable speed increase.
Click to expand...
Click to collapse
Thankyo lgstoian for this how-to
Only a question:
Can I push swapfile.swp in /cache directory instead /data?
/chache has more space free
I guess you can. I haven't tryed it yet. But as it has been said in the thread it's preferable to use the sd and not any internal memory.
Wow, thank you, really speed improvement!
How to make it permanent? We have to modify init.rc in boot image?
Do you have to modify init.rc to make it permanent ? :/
Why not just use swapper?
http://code.google.com/p/a-swapper/
P
Thank you Paul : )
help
hello what we type and where type and what by type
paulobrien said:
Why not just use swapper?
...
P
Click to expand...
Click to collapse
Because not everyone flashed his tattoo and has a custom ROM, so for the folks who have to use the m7 exploit everytime after a reboot, the method lgstoian presented is the only choice
Greets
I have formatted a swap partition on my sdcard. How to use it??
Interesting. However, using swap on SD makes your SD Card unable to unmount. Internal Flash is better, 16MB on my end and I see no damage yet. And the swap is full too (16MB used, 0MB free!)
Yet. Exactly, no damage YET.
The nand flash uses a bad-block management system so i have no idea how one would notice it, i guess files getting corrupt and space being reduced.
Anyway, the only phones running android that need swap are the G1 and 32B magic.
Those phones simply have too little RAM, using straight compcache is a lot better for the 32A Magic (it resides in RAM, thus no damage) and hence the tattoo has the same amount of RAM it is better for it as well

Droid 3 and Swap

Hi everyone... have a question... It's possible to enable swap support on our droids? and if it's how?. Because I'm tired of everytime a switch from one app to another it kills one of them. Thanks!
bump, after a long search it seems to be imposible because current kernel don't have have swap support and with a locked bootloader we can't change the stock kernel, i hope some day motorola unlock our droids bootloader or someone can do it . If i'm wrong please let me know. Thanks!
I activated a swap file on my Droid 3 using mkswap and swapon as root from the command line. The kernel recognized the swap space, but as soon as the phone ran out of memory and tried to swap something, it rebooted.
I'd be interested in hearing if anyone else has had a different result.
rblanca said:
Hi everyone... have a question... It's possible to enable swap support on our droids? and if it's how?. Because I'm tired of everytime a switch from one app to another it kills one of them. Thanks!
Click to expand...
Click to collapse
nicktastique said:
I activated a swap file on my Droid 3 using mkswap and swapon as root from the command line. The kernel recognized the swap space, but as soon as the phone ran out of memory and tried to swap something, it rebooted.
I'd be interested in hearing if anyone else has had a different result.
Click to expand...
Click to collapse
It suprised me that kernel recognize you the swap space...do you create swap file in your internal memory or a sd memory?
Edit: I tried this morning but i have the same results as you... as soons it starts to use virtual momery it rebooted.
edit: Well i play with swappines but same results as soon our device started to use swap it rebooted..perhaps someone with more knowlegde can do something about it...it would be great if someone can do it.
Like all file systems, support for swap must be coded in the kernel (it's not), or added by kernel modules . . . Which would have to be specifically compiled against OMAP4 source code, I think, to work. I'm not a programmer, so I can't help directly. See if whoever provided the community the tun.ko kernel module for D3 can whip us up a swap module. Still, our kernels are locked, so the swap.ko would have to be added to a /preinstall aka 2nd-init kernel. Maybe Hashcode can help?
BTW: this thread should be in development, not General, I think
Sent from my DROID3 using xda premium
I use swap all the time. For instance, currently my phone has 111M RAM free and is using 162M of swap.
I've created a swap partition on an SD card and use that, so no swap file.
白い熊 said:
I use swap all the time. For instance, currently my phone has 111M RAM free and is using 162M of swap.
I've created a swap partition on an SD card and use that, so no swap file.
Click to expand...
Click to collapse
do you have your droid 3 with stock rom or other?. Thanks
I used swap on the stock ROM, currently running the Brazilian Vivo ROM, on 860.
白い熊 said:
I used swap on the stock ROM, currently running the Brazilian Vivo ROM, on 860.
Click to expand...
Click to collapse
Thanks dude, but same story as soon as it start to use swap partition it rebooted... it seems there is something missing on xt862 kernel's
Seems there must be some diff between 860 and 862...
白い熊 said:
Seems there must be some diff between 860 and 862...
Click to expand...
Click to collapse
Yes, it seems...one more favor...can you tell me your full Kernel version and your Android version? Thanks
2.6.35.7-g9f70789
[email protected] #1
and
2.3.5
白い熊 said:
I used swap on the stock ROM, currently running the Brazilian Vivo ROM, on 860.
Click to expand...
Click to collapse
Yes, please explain what you did to obtain Swap. The last Android device I had with functioning swap was the G1/HTC Dream, and we had swap because custom kernels had support for it an modules created the fs every time android booted. Whether a swap partition was created and mounted was up to the rooted user. I have used the makeswap and swapon commands with busybox from the command line and could not get the swap partition to show up in mount. Which address block did you use to create the partition? I tried /dev/mmcblk1p025 and 26 (sdcard and emmc?) and neither worked.
BTW: Many intelligent minds say swap in Android is useless since the Java/DalvikVM is so aggressive about reclaiming memory (just watch logcat to see that happening non-stop). You would have to swap to a device that is as fast as your secondary storage (meaning the 512mb of DDR2 installed in the XT862) in order to "beat" Dalvik's garbage collection and "augment" the natural AndroidOS memory management. One of the gifts of running bytecode in Java is that one does not usually address RAM directly (unless you jump out of Java with some C/C++ code), the OS is always handling your classes-to-registers allocation for you, the developer. In other words, it's Android's job to manage your memory, and if you ask the linux kernel and file system to cache registers to the comparatively "slow" sdcard (flashmem is slower than DRAM), you'll essentially be blocking Android's ability to handling your instructions, data, and files because it will then have to go pick up that data from a slow swap partition. When we were trying to push the G1's limits (which was delivered with a paltry 64mb of userdata space), swap made sense because the time it took to request stuff from swap was much slower than recreating threads out of compcache (compressed and old handles). 512mb is still relatively big for a device, and Android, like Linux, will always buffer most of your memory to make sure you don't run out of space for your apps. I am not a programmer so I may have messed up some of the finer points--but this is the gist of Android-vs-Swap as some see it.
rynosaur said:
Yes, please explain what you did to obtain Swap. The last Android device I had with functioning swap was the G1/HTC Dream, and we had swap because custom kernels had support for it an modules created the fs every time android booted. Whether a swap partition was created and mounted was up to the rooted user. I have used the makeswap and swapon commands with busybox from the command line and could not get the swap partition to show up in mount. Which address block did you use to create the partition? I tried /dev/mmcblk1p025 and 26 (sdcard and emmc?) and neither worked.
Click to expand...
Click to collapse
Swap will have to be setup on the external sdcard, which is /dev/block/mmcblk0p
mmcblk0p1 - * would be the partitions
Exactly, setup a swap partition on an ext SD card, then swap on it. Never had a prob.
I don't really care about Android memory usage and management, I need swap because I run GNU/Linux in a chroot, and for that the measly 150M that the Droid 3 has free by default is useless...
I really like DROID 3 and would get it but 512 of RAM and locked bootloader are killing me. But I can't imagine a better device than this one if those two factors didn't count.
Please tell me that something can be done with ICS, low RAM and custom kernels?
ICS runs good and the only reason I tweak my memory settings is just because Words with Friends is a battery hog and so is FB sometimes. I never seem to run out of RAM.
If you like the keyboard, why not get a Droid 4?
Sent from my DROID3 using xda premium
Droid 4 doesn't support GSM networks and I am from Europe where most of the carriers are GSM and so is mine. Droid 3 xt862 is a global phone (both CDMA and GSM) and Milestone 3 xt860 - GSM only. Besides Droid/Milestone 3 looks much better than D4 as for me.

what is need partition SD card?

"Its recommend to partition your sdcard before flash"
whats the use?..........
you can use cwm with the phone or minitool partition wizard with the pc
venkatarajeev131 said:
"Its recommend to partition your sdcard before flash"
whats the use?..........
Click to expand...
Click to collapse
the rom maybe containing a2sd script that's why it need a second partition do it there is no harm
What size this partition should be? 100MB is enough?
felipevsw said:
What size this partition should be? 100MB is enough?
Click to expand...
Click to collapse
atleast 512 mb for ext parttion you should create a swap partition of 256 mb,
swap will replace the ram according to the swappiness set by you
dhlalit11 said:
atleast 512 mb for ext parttion you should create a swap partition of 256 mb,
swap will replace the ram according to the swappiness set by you
Click to expand...
Click to collapse
So it should be 2 partitions: one with 512 MB and another with 256 MB... The one with 512 should be formatted ext4? and the other swap (of course)?
felipevsw said:
So it should be 2 partitions: one with 512 MB and another with 256 MB... The one with 512 should be formatted ext4? and the other swap (of course)?
Click to expand...
Click to collapse
Set it as ext2, it's faster.
---------- Post added at 08:15 PM ---------- Previous post was at 08:06 PM ----------
dhlalit11 said:
atleast 512 mb for ext parttion you should create a swap partition of 256 mb,
swap will replace the ram according to the swappiness set by you
Click to expand...
Click to collapse
Here's some info on how Linux (and thus Android) uses swap. http://www.linux-tutorial.info/modules.php?name=MContent&pageid=89
I wouldn't bother with it on a phone since Linux will just swap unchanged files right back to where they are on the phone storage without the need for a swap file and since it's unlikely that you'll ever multitask large user files on it there really is no need for it.
felipevsw said:
So it should be 2 partitions: one with 512 MB and another with 256 MB... The one with 512 should be formatted ext4? and the other swap (of course)?
Click to expand...
Click to collapse
swap is optional but it's good to have
dhlalit11 said:
swap is optional but it's good to have
Click to expand...
Click to collapse
For what? Who is changing large data files on their phone? In all likelihood it will cost you more memory to have a swap file than it will save you memory since it won't be used.
Linux won't use it at all if the file in memory hasn't changed since it was last read from storage, it will just swap it back to where it was last read, that is, if you have an app open and more memory is needed linux will first check to see if the file has been changed since last read and since it's an app it will just link it back to where it was read from in the first place rather than to put yet another copy in swap.
Jinxxed said:
For what? Who is changing large data files on their phone? In all likelihood it will cost you more memory to have a swap file than it will save you memory since it won't be used.
Linux won't use it at all if the file in memory hasn't changed since it was last read from storage, it will just swap it back to where it was last read, that is, if you have an app open and more memory is needed linux will first check to see if the file has been changed since last read and since it's an app it will just link it back to where it was read from in the first place rather than to put yet another copy in swap.
Click to expand...
Click to collapse
am not talking about swap file am talking about swap partition and if you think there is no need then why are there paid apps like swapper for root and why are people paying for them.
suppose you are playing shadow gun with help of cf3d after the play you find that all the app like launcher background working apps are stopped due to low ram but if you have swap then the app's memory will move to swap partition and it will not close
when I had mini I had a swap partition of 512 MB and it was really working and if you think the life of SD will decrease then you should know that it has a veeeeeery lil effect on life so don't worry there is no harm
Thank u for this useful thread..
dhlalit11 said:
am not talking about swap file am talking about swap partition and if you think there is no need then why are there paid apps like swapper for root and why are people paying for them.
suppose you are playing shadow gun with help of cf3d after the play you find that all the app like launcher background working apps are stopped due to low ram but if you have swap then the app's memory will move to swap partition and it will not close
when I had mini I had a swap partition of 512 MB and it was really working and if you think the life of SD will decrease then you should know that it has a veeeeeery lil effect on life so don't worry there is no harm
Click to expand...
Click to collapse
Whether you use a swap file or partition is irrelevant, Linux can use either and they work exactly the same.
In your example, all the apps would be swapped RIGHT BACK TO WHERE THEY ARE STORED since they did not change since last read, the swap would be unused and the apps would still be swapped.
I don't know if it's that you fail to comprehend the simple subject or refuse to read both what i post and what i link to but you are not understanding this.
Of course it won't affect the SD cards lifetime, it won't be used.

Categories

Resources