Results 1 to 12 of 12
  1.    #1  
    Buried deep within Linux is an interesting sysctl variable:

    /proc/sys/vm/swappiness

    This variable ranges from 0 to 100, and controls how much pressure the VM system puts on paging unused memory out to swap.

    The default setting for the Linux kernel is 60, and I noticed the Pre has this as default as well. On Linux desktops, dropping this down to 5 can improve responsiveness considerably, since the kernel will stop paging running applications out to disk unless it really needs to.

    After noticing that my Pre swaps a lot of RAM out to disk even when there isn't all that much low memory pressure, I figured I'd try setting swappiness to 5 on my Pre as well. Couldn't hurt, right? Swapping is much slower than direct memory access even on the Pre since flash is a lot slower than RAM.

    If anyone else wants to try, the file to edit is:

    /etc/init.d/swaphack.sh (which already exists)

    Just add:

    echo 5 > /proc/sys/vm/swappiness

    ...right before the "Enabling swap area" echo near the end of the file. Then reboot.

    I'll post in a couple of days what my findings were. So far it feels very snappy but it always does after a reboot.
  2. #2  
    I remember screwing around with my sysctl swappiness in Ubuntu a year or so back. I assume it's about the same with the Pre.

    Thanks for this post!
    Last edited by Sunsparc; 09/22/2009 at 04:24 PM.
  3. diomark's Avatar
    Posts
    752 Posts
    Global Posts
    770 Global Posts
    #3  
    Thanks! I was looking at this value but wasn't sure which way to go with it.. In my experience, swap sucks, in *any* platform.

    -mark
  4. #4  
    Why haven't I thought of this! I have this on my Linux box right in front of me.
    Quote Originally Posted by NickDG View Post
    Welcome to open source. Things can get bumpy. Please fasten your seat belts.
    Quote Originally Posted by dianagr View Post
    You can also swipe a counterclockwise semi-circle around the center button to go back. [Do a back gesture]
  5. punzada's Avatar
    Posts
    137 Posts
    Global Posts
    161 Global Posts
    #5  
    I'm going to be testing this as well as it's always a change I do on my desktop since it has a large amount of ram.
  6. stubbs's Avatar
    Posts
    425 Posts
    Global Posts
    442 Global Posts
    #6  
    Great post, I have played with this on desktops but forgot about it! More things to tweak
  7. tannyo's Avatar
    Posts
    130 Posts
    Global Posts
    133 Global Posts
    #7  
    Quote Originally Posted by zorinlynx View Post
    I'll post in a couple of days what my findings were. So far it feels very snappy but it always does after a reboot.
    How did this work out? Does it really improve performance?
  8. yetdog's Avatar
    Posts
    13 Posts
    Global Posts
    14 Global Posts
    #8  
    Quote Originally Posted by tannyo View Post
    How did this work out? Does it really improve performance?
    I did this but I don't really see much of a difference.
  9. jhp
    jhp is offline
    jhp's Avatar
    Posts
    30 Posts
    #9  
    I played around with this a while back and wound up leaving it at 60; swappiness (as I understand it) acts as a biasing factor when memory needs to be reclaimed; 0 means to look at cached data first, 100 means look at applications, and 50 means treat them equally, so setting it to 0 says don't swap applications until caches have been searched. This also means that idle applications will be spared, even if swapping them out would be a good thing as they're not using the memory that they're consuming (Ie, boot or shortly after boot apps that rarely do anything afterwards). My pre seems to level off at about 24MB swapped with (seemingly) no ill effects.

    I've set swappiness to 0 on my home (6GB) system, and to 60 on my work (2GB) system, and I'm pretty satisfied with those settings.

    One thing that I tried a couple off weeks ago that seems to help is to remount all ext3 filesystems (except /dev/.static) with the nodiratime option; my pre feels snappier, and the battery seems to last longer since I've done this.
  10. diomark's Avatar
    Posts
    752 Posts
    Global Posts
    770 Global Posts
    #10  
    I see a difference with the phone app.. (probably cause it's not swapping while idle..)
    -mark
  11. #11  
    Jhp, what about noatime for files and dirs, or would that be too much.

    Hmm, edit, looks like almost all of them are already using the noatime option, I thought that meant nodiratime was automatically included.
    Last edited by hmagoo; 09/23/2009 at 06:20 PM.
  12.    #12  
    Updating this thread because I've been running with low swappiness for a while.

    Don't bother. I've found performance is better with swappiness at the default value.

    I suspect the chipset in the phone gets slower when memory-starved, leading to poor performance even with memory resident apps after a while when swap isn't used much. This is probably due to memory fragmentation, but it could be anyone's guess.

    Anyway, I restored it to default and performance is actually better long term. Lesson learned!

Posting Permissions