![]() |
How to set swappiness?
I see people discussing changing swappiness but what is the exact way to go about doing it and making it stick at every reboot? Also, I heard you can run swap from the microsd to get a more responsive device?
My phone comes down to a crawl after less then a day of usage. I normally have to repeatedly tap conversations for it to open after a minute so im looking at anything to improve the responsiveness. Thanks for your help! |
Re: How to set swappiness?
swappiness?!?!?
are you referring to swap partition maybe? what unstable stuff have you installed to your device? |
Re: How to set swappiness?
Quote:
I suppose Wikipedia also got some info on that subject. |
Re: How to set swappiness?
Thanks for the link... I roughly know whats swappiness after using Andriod with custom ROM's for over a year. I just dont know how to set it on N900. And google isnt much too :(
|
Re: How to set swappiness?
I'd leave it be, it probably has already been optimized.
|
Re: How to set swappiness?
Quote:
|
Re: How to set swappiness?
Quote:
|
Re: How to set swappiness?
It's /proc/sys/vm/swappiness. As root:
echo "50" > swappiness will change it, though this won't survive a reboot. The default is 100, which is the swappiest. You could try lowering it to, say, 50. You can add a swap partition to your SD card by editing the partitions and adding a Linux swap partition to it (type 82). For example, add a swap partition of 1GB to the SD. Search the internet for fdisk, swapon, swapoff and mkswap to teach you what to do. You'd turn the SD swap on and the internal swap off. Please note: this is for information only. Do what you like with your device, but at the risk of making it not work at all. Personally I'd recommend keeping it set up as it is at the moment. |
Re: How to set swappiness?
Quote:
I think it defaults to swapiness 100, which I think means "go ahead and swap as much as you want" ... which didn't seem right to me so I changed it to 0... not sure if I've noticed much difference... I should change it back again and see... |
Re: How to set swappiness?
From what I've read, the sweet spot is 60... I just set mine to 60. Shall give it a try. Thanks for your help. And for anyone who wants to know the command is
echo 60 /proc/sys/vm/swappiness |
Re: How to set swappiness?
Quote:
And you've missed the critical '>' in the command you've given there. |
Re: How to set swappiness?
Thank you Rob1n. My bad. How do you type > using the n900 keyboard?
|
Re: How to set swappiness?
Quote:
|
Re: How to set swappiness?
Thank you once again. You are a live saver. So just to confirm...
echo 60 > /proc/sys/vm/swappiness |
Re: How to set swappiness?
Quote:
Code:
cat /proc/sys/vm/swappiness |
Re: How to set swappiness?
Yep it's 60 :) Thank you!
|
Re: How to set swappiness?
Could you tell us how much better does it perform with the new value after some use?
|
Re: How to set swappiness?
I have been running my N900 with swappiness 30 for some weeks without any ill side-effect. But it seems that battery-life and device responsiveness have both noticably improved.
BTW, on Diablo OS, the default swappiness value was 1. I'm almost certain that a default value of 100 on the N900 is not the optimal setting for this device at all. |
Re: How to set swappiness?
Thanks Pycage!
Do you know how to set it so the value will persist after reboot? |
Re: How to set swappiness?
On n900 default value for swappiness is set by /etc/init.d/rcS script somewhere in the last lines.
echo value > /proc/sys/vm/swappiness works until the next reboot. So if you want to change the value permanently you should edit it in rcS script. |
Re: How to set swappiness?
Quote:
|
Re: How to set swappiness?
Quote:
If you chose to edit it on computer then you should first copy it for example in MyDocs using terminal: cp /etc/init.d/rcS /home/user/MyDocs/ Edit it and then copy it back: cp /home/user/MyDocs/rcS /etc/init.d/rcS Be careful not to edit something else in this script as it may result in unbootable device and you would have to reflash firmware to restore it. |
Re: How to set swappiness?
Quote:
|
Re: How to set swappiness?
Quote:
if you move rcS around, make sure it end up with exec permitions. ls -al /etc/init.d/rcS will show rwxr-xr-x (look at the 3 x) will it not work inside MyDocs, but if it loses that permitions, you can set it back with: chmod +x /etc/init.d/rcS you can check it with: ls -al /etc/init.d/rcS |
Re: How to set swappiness?
Hmm. I decided to use midnight commander. easier then expected. I browsed to the folder, tapped edit, searched for "swappiness", changed the 100 to 30, saved it, and rebooted.
cat /proc/sys/vm/swappiness shows 30. Lets see how much of an improvement there is. |
Re: How to set swappiness?
I tried this
echo 0 > /proc/sys/vm/page-cluster in vim /etc/init.d/rcS line 264. guided by this blog http://www.sabi.co.uk/blog/anno05-3rd.html#050923 Seemed to reduce the pressure on VM usage. |
Re: How to set swappiness?
Hey guys i thought ill bring this thread back to life.. i have been using swappiness to 30 past few days..
I dont see any ill effects at all.. and performance seems to have improved a lot .. and battery life by a bit if im not imagining things am running 750 mhz clocked kernel.. |
Re: How to set swappiness?
I have also tested swappiness 30 and page-cluster 0. I'm pretty sure that responsivness has been better. I would be highly interested on possible side-effects on these changes.
btw. is it possible to unload preloaded modest and browserd? .edit I have also seen some nice value tweaks. Have you tried them and what were the results? |
Re: How to set swappiness?
Quote:
http://talk.maemo.org/showthread.php?t=47173&page=2 Did you decide 30 is better? |
Re: How to set swappiness?
I just switched swappiness to 30,... much faster in starting and stopping applications,... just more responsive overall.
To give a comparison, Ubuntu defaults to a swapiness value of 60. On some server systems, where a large program is going to remain in memory while other tasks are being performed, a swappiness value of 100 can be advisable, but 60 is the sweet spot for desktop/server hybrid use (which is why they use that). For most desktop use, with a decent amount of RAM, you want to have a swappiness setting of 10 on Ubuntu systems... The trade off is having enough virtual memory for keeping application that are idle running and happy, versus having too much being pushed to virtual memory. With flash memory, it has limited read-write cycles, even with modern level wearing stuff going on, so lower swappiness will help the system's flash memory lifespan. For the N900, because it has flash storage, a setting of 60 is probably too much. And since flash memory's faster than disk, a 30 is proabably about right for the N900. Setting it too low (like a 0 or a 1) might possibly effect some daemons (Like phone related stuff) running in the background that we might not be aware of. But overall, I agree that a 100 is way out of line. Running at 30 makes it seem like a whole new device. |
Re: How to set swappiness?
how do i edit with midnight commander? i can locate the rcS edit it but it wont save my settings?
|
Re: How to set swappiness?
Quote:
However, the swapiness 100 is definitely wrong, at least with current kernel - it doesn't have a conditional swapiness which would stop swap ops in progress if there is no "not-enough-memory" condition and some urgent flash IO. |
Re: How to set swappiness?
You must become root before starting mc. Install package 'rootsh', start xterminal, write
Code:
root |
Re: How to set swappiness?
I highly recommend to anybody who wants to change rcS - instead of that just create a file /etc/event.d/somename with following lines:
Code:
description "my somename fix" This would not corrupt your N900 in case of problem and it allows the next Nokia OTA upgrade. You need to be root and run your favorite editor (see prev posts for know how to edit file). |
Re: How to set swappiness?
Quote:
|
Re: How to set swappiness?
how do i get this symbol in n900??
> |
Re: How to set swappiness?
Quote:
Consider that writing a single 4K RAM page consists of 8 x 512B writes (with the only benefit being that -this- page will be contiguous) and if you're pushing off more than a few pages swap partition, you're going to be hurting. The eMMC lacking moving parts should maintain throughput much better. If you're real curious, you could always throw IOMeter at it ;) |
Re: How to set swappiness?
|
Re: How to set swappiness?
Quote:
To save you some time, here is what the manual says: "Press and hold (the diagonal blue arrow) and then press the sym key." |
Re: How to set swappiness?
Actually, flash devices are more suitable for streaming then random access - there is a serious logic behind that. Yes the random access in flash is faster for READ but write is another story and it is not very good for flash devices yet.
In any way, swap write is essentially a sequential operation. Kernel does a special logic behind this. |
All times are GMT. The time now is 06:34. |
vBulletin® Version 3.8.8