RAM optimization

48 views
Skip to first unread message

Pradeep

unread,
Aug 20, 2011, 7:18:41 AM8/20/11
to android-porting
Hi,

I am trying to reduce some lagginess in my platform and wanted to try
out some tweaks as mentioned in following link

http://forum.xda-developers.com/showthread.php?t=1111145

It is trying to change values of following parameters

/proc/sys/vm/swappiness
/proc/sys/vm/vfs_cache_pressure
/proc/sys/vm/dirty_expire_centisecs
/proc/sys/vm/dirty_writeback_centisecs
/proc/sys/vm/dirty_ratio
/proc/sys/vm/dirty_background_ratio

Is it safe to do so ?
Any ideas why these values help in reducing the lagginess ?

Regards,
Pradeep

Dianne Hackborn

unread,
Aug 21, 2011, 8:40:01 PM8/21/11
to bhatt....@gmail.com, android-porting
You really really do not want to just poke values in to these things trying to find something that seems to work.

There are a lot of reasons a device can be "laggy."  Specifically in terms of RAM, this is usually a matter of how much paging the kernel needs to do as your running apps use their ram vs. how much background app processes are killed to reclaim memory for foreground apps.

On devices with a lot of RAM, this is not much of an issue, so the values (in particular the oom minfree values) are generally tuned conservatively to more aggressively kill background processes in order to avoid paging. 

When you are getting tight on RAM, there is a careful balance between having enough RAM to keep everything running in the background the user may reasonably desire and avoiding paging.

Also the desired values for these vary with the type of device -- for example a device with a higher resolution screen needs more RAM for its frame buffers; one with a higher density screen needs more RAM for its widget graphics.  These both increase the overall working set of the running system, requiring more RAM available to avoid paging.

The current values for these in the GB tree are tuned for a Nexus S style device -- a fair amount of RAM, hdpi phone screen.  You can tune those down a bit for lower-end devices, but keep a careful eye on how much paging is happening.

Of course if your laginess is not related to paging, none of this will help.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Pradeep

unread,
Aug 22, 2011, 3:21:27 AM8/22/11
to android-porting
Thanks Dianne !

I think what we need to do is first find the cause of lagginess.
Anyone knows of tool to find how much paging is happening ?

Regards,
Pradeep
> hack...@android.com
Reply all
Reply to author
Forward
0 new messages