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)

shadowjk 2010-09-07 20:10

Re: How to set swappiness?
 
Well it's write mixed with reads, which on all sd/mmc/usbflash I've seen translates into a big read/modify/write cycle right after write-read commands come from host..

At one point I plotted all writes done by kswapd, and found that it's indeed mostly sequential until it reaches the end of the swap area, after which it becomes increasingly random.. swapoff/swapon fixes that, and I now have a script that checks iostat for amount of writes and does swapoff/swapon/swapoff via a temporary swapfile when writes exceed swap size..

msa 2010-09-09 19:56

Re: How to set swappiness?
 
i created a file named swapmop in etc/event.d/

content:
Quote:

# swappiness auf 30

start on started rcS-late

script
echo 30 > /proc/sys/vm/swappiness
end script
then i rebooted.
when doing cat /proc/sys/vm/swappiness, it still sais "100"

what am i doing wrong? :O

slender 2010-09-09 20:12

Re: How to set swappiness?
 
Quote:

Originally Posted by shadowjk (Post 809968)
...and I now have a script that checks iostat for amount of writes and does swapoff/swapon/swapoff via a temporary swapfile when writes exceed swap size..

Would it be possible to share that script with us? :)

sake 2010-09-09 20:41

Re: How to set swappiness?
 
Quote:

Originally Posted by msa (Post 811948)
i created a file named swapmop in etc/event.d/

content:


then i rebooted.
when doing cat /proc/sys/vm/swappiness, it still sais "100"

what am i doing wrong? :O

try to add:
Code:

#!/bin/sh
at the very beginning of your script.
also try
Code:

chmod a+x /etc/event.d/swapmop
as root

msa 2010-09-09 21:09

Re: How to set swappiness?
 
Quote:

Originally Posted by sake (Post 812002)
try to add:
Code:

#!/bin/sh
at the very beginning of your script.
also try
Code:

chmod a+x /etc/event.d/swapmop
as root

the #!/bin/sh helped! thanks!
though right now i'm not seeing any differences at all...

/edit:
ha, there is a difference: my RAM-usage is constantly at around 180 mb. not sure if thats good...?!

egoshin 2010-09-10 20:49

Re: How to set swappiness?
 
#!/bin/sh should not have difference. But don't forget a space between 30 and >

Actually, it is better to use this script in /etc/event.d/myscript

Code:

description "tuning system"
author My Name

console output

start on started rcS-late

script
        echo "30" > /proc/sys/vm/swappiness
end script


Sorry for possible misguide...

DrWilken 2010-09-10 21:01

Re: How to set swappiness?
 
Quote:

Originally Posted by msa (Post 812031)
ha, there is a difference: my RAM-usage is constantly at around 180 mb. not sure if thats good...?!

Using the memory available isn't a BAD thing... ;) Running out of memory is though... :) That's where swap is useful.

High swappiness makes the system swap out (RAM->SWAP) aggressively (idle processes memory blocks are moved to disk).

Low swappiness swaps out when memory is running full instead.

http://kerneltrap.org/node/3000

Experiment with it and find out what setting fits Your usage pattern... ;)

I wouldn't recommend setting the value too low (30 seems fine here so far).

msa 2010-09-10 22:13

Re: How to set swappiness?
 
Quote:

Originally Posted by egoshin (Post 813005)
#!/bin/sh should not have difference. But don't forget a space between 30 and >

Actually, it is better to use this script in /etc/event.d/myscript

Sorry for possible misguide...

thanks!

i tried to use your script, but it did not work. i ended up modifying it until i had the first script i used to make it work.

i had to remove the following part:
Code:

description "tuning system"
author My Name

console output

and still add the #!/bin/sh to make it work. i tried different combinations also, but non worked.

DrWilken 2010-09-10 22:24

Re: How to set swappiness?
 
This worked for me (/etc/event.d/tuning):
Code:

description "System Tuning"
author "Christian Wilken"

console output

start on started rcS-late

script
        echo "30" > /proc/sys/vm/swappiness
        echo "1" > /proc/sys/vm/oom_kill_allocating_task
end script

No chmod'ing or anything else needed (look at all the other files in /etc/event.d)... ;)

matthew maude 2010-09-10 22:55

Re: How to set swappiness?
 
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


All times are GMT. The time now is 09:41.

vBulletin® Version 3.8.8