N900 Kernel Memory (and more) Optimizations

So I’ve begun trying out some of the optimizations I’ve been using on my Debian machines for the past 8 or 9 years, on my N900. While I would have loved to see 512MB or more, the size we have is very usable as is. So in order to help you maximize the performance of your N900 I’ve compiled a list of simple (and completely reversible) optimizations that I’ve been using for a while that are relatively safe, but I’m not responsible for anything malafashion that happens. I’m using the Community Power-Kernel by Tom Tanner that I discussed in my previous article. It’s patched to the hilt already, but the changes listed below are extremely noticeable.

pengwings Most tweaks consist of tuning caches controlled by the kernel VM and I’m using values that are optimized for perceived performance. What happens in the background, happens, but I want my UI to be as fluid and responsive as possible. No more screen tearing, no more jagged responses. So sit down, strap in and let’s give our penguins some wings…



echo 30 > /proc/sys/vm/swappiness - The N900 is notoriously slow when doing multiple disk reads or writes. So I lower the “desire” for it to swap out pages. Less paging means more data will be stuck in RAM, so adjust it accordingly if you find yourself running out of memory. I run a cronjob that drops buffer cache containing pagecache, dentries and inodes, to clear out unused dirty pages (sync; echo 3 > /proc/sys/vm/drop_caches).

echo 0 > /proc/sys/vm/page-cluster - When it does swap out, I don’t want it doing huge operations and temporarily freeze the UI due to slow IO bus coupled with the use of CFQ scheduler instead of NOOP.

echo 1 > /proc/sys/vm/laptop_mode - But I do want it to smartly schedule when it’s going to write, so I’m not trying to write to disk when my device is in sleep mode. This might also help with reducing sporadic writes and saving the flash module.

echo 1 > /proc/sys/vm/oom_kill_allocating_task – Instead of killing “lower” priority or idle processes, I’d prefer whichever application tripped an Out-Of-Memory error, to be killed. The tasks I have in background are there for a reason.

echo 0 > /proc/sys/vm/dirty_expire_centisecsThis tells the kernel how often to look for modified/dirty pages in RAM that needs to be written to disk.

echo 0 > /proc/sys/vm/dirty_writeback_centisecsThis tells the kernel how old modified/dirty pages need to be, before they can be considered for flushing.

echo 60 > /proc/sys/vm/dirty_background_ratioThis is the lowest (percent) amount of memory where a dirty page flush can stop.

echo 95 > /proc/sys/vm/dirty_ratioThis is the highest (percent) amount of memory that can be stored before a force flush happens.

echo 0 > /proc/sys/net/ipv4/tcp_timestampsI disable timestamps so the processor has less data to deal with when traffic comes in. Packets can be resent if they’re OOB or clocked wrong.

echo 1 > /proc/sys/net/ipv4/tcp_no_metrics_saveI also disable saving threshold metrics. Just ‘cause I’m gangster like that.


So that’s a couple of relatively safe and stable steps you can take to significantly boost your N900 performance and response time. Feel free to call me a fool for some of the values I’m using. I’ll consider your argument.

The heavy-hitters in the Android community have been tuning their kernels for quite a while and giving users awesome experience with their full customized and pre-cooked ROMS. It’s about time we catch-up to their supremeness dontchathink?


Chris said...

Trying these out as we speak.

Say, is there a way to get these settings to load automatically on startup? I'm guessing come boot time these settings go back to default?

Simon said...

Yes, after a reboot these will revert back. You have 2 option; /etc/init.d/rcS sets some of the values, look towards the end of the script. Or you can stash them in
a shell script and call it during boot using an entry in /etc/event.d/

Do this at your own risk though.

Anonymous said...

Very interesting post, Simon, as always.

I plan on trying these out, what is the best way to actually gauge performance on how well the N900 is doing? Is there a way to log statistics (perhaps from TOP or HTOP)?

David Hulbert said...

If anyone needs the original values:

Nokia-N900-02-8:~# cat /proc/sys/vm/swappiness
Nokia-N900-02-8:~# cat /proc/sys/vm/page-cluster
Nokia-N900-02-8:~# cat /proc/sys/vm/laptop_mode
Nokia-N900-02-8:~# cat /proc/sys/vm/oom_kill_allocating_task
Nokia-N900-02-8:~# cat /proc/sys/vm/dirty_expire_centisecs
Nokia-N900-02-8:~# cat /proc/sys/vm/dirty_writeback_centisecs
Nokia-N900-02-8:~# cat /proc/sys/vm/dirty_background_ratio
Nokia-N900-02-8:~# cat /proc/sys/vm/dirty_ratio
Nokia-N900-02-8:~# cat /proc/sys/net/ipv4/tcp_timestamps
Nokia-N900-02-8:~# cat /proc/sys/net/ipv4/tcp_no_metrics_save

Anonymous said...

made the mods about 12 last nite, reboot and they are still there. It's a heck of a lot more responsive.

Anonymous said...

It's absolutely awesome.
Please tell me, how often do you run that cron job you referred to?
Thanks a lot for all that :)

Dagui said...

Yes, could you please detail the cron job? Will the device get slower when it runs? Will there be any stability problem if the cron job is not running while using this custom settings?

Denis said...

hmm. is the "performance boost" measurable ?
care to provide numbers ?

Anonymous said...

Are you sure you don't have the description of "dirty_expire_centisecs" & "dirty_writeback_centisecs" mixed up?

Thanks for all of this btw

Anonymous said...

What's up to all, it's in fact a nice for me to go to
see this web site, it includes useful Information.
My site ... verdes comprimidos de café

Anonymous said...

Wow! Aftег аll Ι gοt a
website from where I be caρable of truly obtаin useful dаtа regаrding mу study
anԁ knoωledge.
Look at my web page Optimal Stack

Anonymous said...

These are really fantastic ideas in on the topic of blogging.
You have touched some pleasant things here. Any way keep up wrinting.
Check out my blog ; Www.Fitnessvictory.Com

Anonymous said...

Quality articles is the key to attract the people to pay a
visit the web page, that's what this website is providing.
My blog post - lift and glow pro review

Anonymous said...

Piеce of wгіting writing is also a fun, if you know afterward уou can writе or elѕe іt is сοmplex tо ωrite.

Stop by my web page :: http://freshsmokenow.com
My web-site :: Rauchen aufhören, fresh smoke, fresh smoke ecig, fresh smoke electronic cigarette, water vapor cigarette, water vapor ecig, dejar de fumar, fumo fresco, humo fresco,basta de fumar,parar de fumar, stop smoking now,

Anonymous said...

What I dіdn't know was how I would get all of what I wanted in just six hours. Yet another way to construct a device to harness energy from radio waves is using an antenna, connected to a series of diodes and a capacitor bank that is earthed. These include the artist-branded music channels such as The Grateful Dead Channel, Eminem's Ѕhаde 45, Jіmmy Buffеtt's Radio Margaritaville; there is even the classical music Metropolitan Opera Radio channel.

Feel free to visit my page - http://ea.dev.ticcon.net/index.php?title=Clarifying_Quick_Secrets_Of_radio

Anonymous said...

wοnderful points altogetheг, уоu ѕimply won a emblem new reader.
What would you гecοmmend in regards to yоuг publish
that you ѕimplу made ѕоme days in the рaѕt?
Any рositive?

Review my webѕite: More hints

Anonymous said...

You ought to take part in a contest for one of the
highest quality sites on the web. I am going to
recommend this blog!

My webpage; http://byurbapinnp.blogspace.fr/6328293/Was-die-Optik-anbelangt-so-wurden-glaubten-viele-Spieler-sie-nicht-anders-als-andere-Fortsetzunge/

Anonymous said...

Excellent article. Keep writing such kind of information on your
blog. Im really impressed by it.
Hi there, You have performed a fantastic job.
I will definitely digg it and personally suggest to
my friends. I'm confident they will be benefited from this site.

Here is my web blog ... internet radio

Anonymous said...

The reason for this is muscle is build up when your physical exercise burns your fat.
Der primäre Punkt, halten den Sport übertragen in einem langsameren Tempo kann die Art der Wette zu platzieren
erwerben. Nuvoryn is a dietary slimming supplement like no other as it not only helps a
person lose weight, but it helps lose weight efficiently.

Feel free to surf to my website :: wiki.ge.gate.vn
My website: Read More

Anonymous said...

Please supplement charge before use when the battery has been kept for a long time.
The Lenmar 1530 m - Ah for the Amazon Kindle 1 e-reader
is the first choice for consumers. While the older
17 inch Mac - Book Pros lack the benefits of the unibody design,
they do have the added feature of user-replaceable batteries.

Here is my blog - kostenlos spiele spielen
Also see my webpage > spiele spielen

Anonymous said...

Its lіkе you rеaԁ my mind!

You apρear to κnow a lot about this, like you wrote the bоoκ
in it or something. I thіnk that yоu can do ωіth a few piсs to drіve the
messаge home a little bit, but οthеr than
that, this is magnifiсent blog. An excellеnt read.

І ωill definіtely be back.

Feel free to visit mу web-ѕite - raspberry ketone

Anonymous said...

Part 2 of this series on marketing your small business using Facebook
offers social media marketing tips and guidelines for how to attract fans to
your Facebook page. If you already have your Facebook fan or business
page created you will need to have 25 fans or "LIKES" in order to
create a custom URL. Link ' Recommend sites to other users and vice versa.

Also visit my webpage facebook likes kaufen

Anonymous said...

Awesome! Іts gеnuinely amаzing аrticle,
I hаve got much сlear idea on
the topic of from this post.

Here is mу blοg - vistaprint coupons

Anonymous said...

Awesоme! Its genuinely remаrkablе piеce of ωrіting, I
haνe gοt much сlear idea regarding from this paгagraph.

Feel fгee to νisit mу blog ρost: green coffee bean extract dr oz buy

Anonymous said...

wonderful issues altogether, you just received a
brand new reader. What could you suggest about your publish that
you simply made a few days ago? Any sure?

Have a look at my website :: litstalker.ru

Anonymous said...

Thanks in support of sharing such a fastidious idea, paragraph is nice, thats
why i have read it entirely

my web blog :: bock of ra

Anonymous said...

Great article! That is the kind of info that are meant to be shared across the web.
Shame on the seek engines for no longer positioning this
post upper! Come on over and talk over with my site .
Thanks =)

Feel free to surf to my site :: e-cigaret væske :
: :

Anonymous said...

Forr the reason thаt the admin of thi website іs working, no uncertainty very quickly itt ωill be famous, ԁue to its feature contents.

Нere iѕ my blog post - buy ht rush

Anonymous said...

Hi there I am so delighted I found your blog
page, I really found you by error, while I was searching on Aol for something
else, Nonetheless I am here now and would just
like to say thanks a lot for a fantastic post and a all round thrilling blog (I
also love the theme/design), I don't have time to look
over it all at the moment but I have book-marked
it and also included your RSS feeds, so when I have time I will be back to read a great deal more,
Please do keep up the excellent work.

my website; fat burning pills

Post a Comment