maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   How to set swappiness? (https://talk.maemo.org/showthread.php?t=48966)

DrWilken 2010-09-11 06:38

Re: How to set swappiness?
 
Quote:

Originally Posted by matthew maude (Post 813085)
its easier to use vi editor for this, run

sudo gainroot

vi /etc/init.d/rcS

scroll down to 263/281

press the letter i - don't press enter after

it looks like this
echo 100 > /proc/sys/vm/swappiness

use the arrows to move the cursor and change the value to 30 or whatever you want - keep it above 30 tho

then press the onscreen 'esc' button

then type this

:wq

then hit enter

Or move the curser till it's over the 1 in 100 and press rw (replace word), enter 30, then esc, and then :wq ;)

There's a reason for creating a new event.d script though (I also edited rcS at first).

matthew maude 2010-09-11 08:29

Re: How to set swappiness?
 
Quote:

Originally Posted by DrWilken (Post 813244)
Or move the curser till it's over the 1 in 100 and press r (replace), enter 30, then esc, and then :wq ;)

There's a reason for creating a new event.d script though (I also edited rcS at first).

ah, didn't know that
i'm so new to linux that i only found out about vi a few days ago whilst trying to add aliases to root/.profile
and i only found out cos i overwrote the damn file and lost the ability to run any apt command or do a reboot
learning something new every day tho :D

DrWilken 2010-09-11 08:43

Re: How to set swappiness?
 
Google for Vi Cheat Sheet... ;)

Oh, and have a nice journey... :cool:

kaze.daniel 2010-09-13 23:15

Re: How to set swappiness?
 
what about that:

HTML Code:

# my rcS.e fix

start on started rcS-late

script
      echo 30 > /proc/sys/vm/swappiness
      echo 0 > /proc/sys/vm/page-cluster
      echo 1 > /proc/sys/vm/laptop_mode
      echo 1 > /proc/sys/vm/oom_kill_allocating_task
      echo 0 > /proc/sys/vm/dirty_expire_centisecs
      echo 0 > /proc/sys/vm/dirty_writeback_centisecs
      echo 60 > /proc/sys/vm/dirty_background_ratio
      echo 95 > /proc/sys/vm/dirty_ratio
      echo 0 > /proc/sys/net/ipv4/tcp_timestamps
      echo 1 > /proc/sys/net/ipv4/tcp_no_metrics_save
end script


egoshin 2010-09-14 01:15

Re: How to set swappiness?
 
Quote:

Originally Posted by kaze.daniel (Post 815333)
what about that:

HTML Code:

# my rcS.e fix

start on started rcS-late

script
      echo 30 > /proc/sys/vm/swappiness
      echo 0 > /proc/sys/vm/page-cluster
      echo 1 > /proc/sys/vm/laptop_mode
      echo 1 > /proc/sys/vm/oom_kill_allocating_task
      echo 0 > /proc/sys/vm/dirty_expire_centisecs
      echo 0 > /proc/sys/vm/dirty_writeback_centisecs
      echo 60 > /proc/sys/vm/dirty_background_ratio
      echo 95 > /proc/sys/vm/dirty_ratio
      echo 0 > /proc/sys/net/ipv4/tcp_timestamps
      echo 1 > /proc/sys/net/ipv4/tcp_no_metrics_save
end script


Just add first 4 lines to be in sync with coding standards:

Code:

description "it is my own N900 tuning"
author "YourName"

console output

instead of ugly line started from # (sorry for that). And please - enclose any numeric value before '>' sign into double-quotes like

echo "95" > /proc/sys/vm/dirty_ratio

It could not expose you to very common bug - the sequence like '95>' without space has a special meaning in shell.

Note: I didn't evaluate the effect of that "echo" commands.

allnameswereout 2010-09-14 01:51

Re: How to set swappiness?
 
For an explanation of these settings and values see http://www.knownokia.ca/2010/08/n900...-and-more.html

FWIW, I'm gonna try them out next days.

smackpotato 2010-09-14 01:53

Re: How to set swappiness?
 
I have a long time ago made a script that sets swappiness to 100 it is on the garage it is called "seatbelt" install the script will set swappines at startup.
whether this is a good thing to do i do not know. It worked great on the 770

SavageD 2010-09-14 02:37

Re: How to set swappiness?
 
To save users the time of searching, It's here ...

Using the seat belts read me file, I'm guessing we have to do this?

As root.
Copy the script to /etc/init.d
Change script mode to executable
Create this symbolic link using this command:

ln -s /etc/init.d/<Script Name> /etc/rc2.d/S80seatbelt"

Reboot

And

To reverse changes, remove the link and script...

So basically all we need to do is create a sym link to a script for it to run on start up?

allnameswereout 2010-09-14 03:07

Re: How to set swappiness?
 
Quote:

Originally Posted by SavageD (Post 815382)
To save users the time of searching, It's here ...

Using the seat belts read me file, I'm guessing we have to do this?

As root.
Copy the script to /etc/init.d
Change script mode to executable
Create this symbolic link using this command:

ln -s /etc/init.d/<Script Name> /etc/rc2.d/S80seatbelt"

Reboot

And

To reverse changes, remove the link and script...

So basically all we need to do is create a sym link to a script for it to run on start up?

Ehm...

Quote:

# swappiness can be set from 1 to 100
echo 100 > /proc/sys/vm/swappiness
echo 2 > /proc/sys/vm/overcommit_memory
echo 40 > /proc/sys/vm/overcommit_ratio
:confused:

No need for fugly sysvinit junk.

On Maemo 5 just put in /etc/event.d/tuning

Code:

description "N900 tuning"
author "VA"

console output

start on started rcS-late

script
      echo "30" > /proc/sys/vm/swappiness
      echo "0" > /proc/sys/vm/page-cluster
      echo "1" > /proc/sys/vm/laptop_mode
      echo "1" > /proc/sys/vm/oom_kill_allocating_task
      echo "0" > /proc/sys/vm/dirty_expire_centisecs
      echo "0" > /proc/sys/vm/dirty_writeback_centisecs
      echo "60" > /proc/sys/vm/dirty_background_ratio
      echo "95" > /proc/sys/vm/dirty_ratio
      echo "0" > /proc/sys/net/ipv4/tcp_timestamps
      echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save
end script

For explanation of each of these settings see URL in my previous post.

iareraccoon 2010-09-14 04:18

Re: How to set swappiness?
 
Quote:

Originally Posted by kaze.daniel (Post 815333)
what about that:

HTML Code:

# my rcS.e fix

start on started rcS-late

script
      echo 30 > /proc/sys/vm/swappiness
      echo 0 > /proc/sys/vm/page-cluster
      echo 1 > /proc/sys/vm/laptop_mode
      echo 1 > /proc/sys/vm/oom_kill_allocating_task
      echo 0 > /proc/sys/vm/dirty_expire_centisecs
      echo 0 > /proc/sys/vm/dirty_writeback_centisecs
      echo 60 > /proc/sys/vm/dirty_background_ratio
      echo 95 > /proc/sys/vm/dirty_ratio
      echo 0 > /proc/sys/net/ipv4/tcp_timestamps
      echo 1 > /proc/sys/net/ipv4/tcp_no_metrics_save
end script


I've switched to this script from the 15 swappiness I had previously and I noticed a significant speed boost! Thanks!


All times are GMT. The time now is 05:48.

vBulletin® Version 3.8.8