Jump to content

Welcome to CyanogenMod

Welcome to our forum. Like most online communities you must register to post, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of the CyanogenMod Forum by signing in or creating an account. You can even sign in with your Facebook or Twitter account.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get automatic updates
  • Get your own profile and make new friends
  • Download files attached to the forum.
  • Customize your experience here
  • Share your CyanogenMod experience!
Guest Message by DevFuse
 

Possible performance boost with vm.swappiness=0 (apparently confirmed?)


  • Please log in to reply
11 replies to this topic

#1 Crest of a Wave

Crest of a Wave
  • Members
  • 6 posts
  • Device Model:HTC Desire Z
  • MOD Version:7.1.0
  • Recovery Image:ClockworkMod

Posted 15 December 2011 - 08:28 PM

I did the edit you suggested, and my Quadrant tests upped from 2300~ to 2500~.

The performance increase wasn't an awful lot noticeable, but it was there.

Aaaaand I didn't get any errors with the said command altered.

My phone (DZ*) is running CM 7.1.0, and I overclocked the processor to 1,2GHz.
Would you like me to post logs or anything like that? - If so, then please provide me with the files, and the appropriate way to find them. ^^

(*) Meaning it's not G2, since I'm not from America.

Edit: O dear, seems as if I revived a post.

Edited by Crest of a Wave, 15 December 2011 - 08:32 PM.


#2 Malix

Malix
  • Members
  • 5 posts
  • Twitter:malix82
  • Country:fi
  • Device Model:Desire Z
  • MOD Version:7.2 rc1
  • Recovery Image:ClockworkMod

Posted 20 December 2011 - 09:50 AM

Thanks for testing & atleast somewhat confirming!

 Crest of a Wave, on 15 December 2011 - 08:28 PM, said:

I did the edit you suggested, and my Quadrant tests upped from 2300~ to 2500~.

The performance increase wasn't an awful lot noticeable, but it was there.
On my friends G1 (or Dream, was it?) the difference is quite clear, he has a screen full of widgets and eBuddy in the background. Without swappiness=0 its sluggish to use (~5seconds from any app to desktop) and with swappiness=0 its ~1sec. On my Desire Z/G2 the ADW.Launcher Ex became a bit more responsive.

 Crest of a Wave, on 15 December 2011 - 08:28 PM, said:

Edit: O dear, seems as if I revived a post.
Heh, so? If this isn't completely placebo, maybe it should be made known :)

edit: doh, forgot to answer: nah, I don't need logs or anything, the quadrant test results etc are enough for me, no idea if somebody else would want further proof.

Edited by Malix, 20 December 2011 - 10:30 AM.


#3 aka369

aka369
  • Members
  • 2 posts
  • Country:us
  • Device Model:Tmo G2
  • MOD Version:CM 7.1.0
  • Recovery Image:ClockworkMod

Posted 24 December 2011 - 02:46 PM

I'm running CM 7.1.0 on my Tmo G2 with the CPU at 1.2 GHz
Quadrant results increased from 2342 without to 2407 with swappiness=0.
While it's only a 1% increase (and not really noticeable to me at least), it still is an increase none the less.

#4 Rich0

Rich0
  • Members
  • 16 posts
  • Device Model:|2|
  • MOD Version:stable
  • Recovery Image:ClockworkMod

Posted 25 December 2011 - 01:04 PM

While my gut reaction was that changing swapiness shouldn't matter if you don't have a swap file, I was thinking about this and realized that files that are mmapped behave like a backing store, and so they CAN be swapped.  I have no idea if swappiness impacts this but I'm guessing it does.

Things that get mmapped would include any executable run by the OS for sure (all the non-java stuff that is running, libraries, etc).  I don't know how dalvik is implemented but there is a decent chance it uses mmap.  Of course, once a page is modified (JIT, etc), it can no longer be swapped out without an actual swap file.  Processes in linux can use mmap for various things - I'm not sure how much Dalvik/etc takes advantage of this, but any file that is kept open in this way could be swapped out to disk to various extents.

The tradeoff with swappiness=0 is that you're tending to keep inactive stuff in RAM just in case it is used, at the expense of less cache.  With spinning disks that is usually a very bad tradeoff, but I suspect it works out differently with flash.  Most of the bigger benefits of a high swappiness (like flushing out pages full of memory leaks) don't apply without a swap file.  

I think the key is to observe performance under a variety of real-world scenarios.  A faster benchmark is nice, if your typical workload consists of running benchmark apps.  In particular I'd be interested in responsiveness when switching between several apps, or switching from navigation to a call with an mp3 playing in the background, or other real-world scenarios.  Obviously those are harder to accurately test.

#5 Crest of a Wave

Crest of a Wave
  • Members
  • 6 posts
  • Device Model:HTC Desire Z
  • MOD Version:7.1.0
  • Recovery Image:ClockworkMod

Posted 29 December 2011 - 01:53 PM

I tried heavy-ish multi tasking between 2 games (namely Hot Pursuit and GTA3), google maps, music, market, Go contacts, Aurora (Firefox Alpha).
Avast mobile sec was running at all times. I should also denote that the processor was running at 1,4GHz.
As well as that, since posting I have also applied this http://forum.xda-dev...ad.php?t=991276

I want to try it using the stock value. I guess that using
sysctl -w vm.swappiness=60

would work, correct? - Going to try once I can get a confirmation answer.

Thanks in advance.

#6 Malix

Malix
  • Members
  • 5 posts
  • Twitter:malix82
  • Country:fi
  • Device Model:Desire Z
  • MOD Version:7.2 rc1
  • Recovery Image:ClockworkMod

Posted 02 January 2012 - 02:55 PM

 Crest of a Wave, on 29 December 2011 - 01:53 PM, said:

I want to try it using the stock value. I guess that using
sysctl -w vm.swappiness=60

would work, correct? - Going to try once I can get a confirmation answer.

yep, that would be the default setting, afaik. Of course it is possible that  'All wheel drive' -thingie has modified swappiness too.

#7 Crest of a Wave

Crest of a Wave
  • Members
  • 6 posts
  • Device Model:HTC Desire Z
  • MOD Version:7.1.0
  • Recovery Image:ClockworkMod

Posted 03 January 2012 - 09:32 AM

 Malix, on 02 January 2012 - 02:55 PM, said:

yep, that would be the default setting, afaik. Of course it is possible that  'All wheel drive' -thingie has modified swappiness too.

Did try both swappiness settings and I didn't really notice that much of a difference.
Though I'm afraid I can't do more testing on this since I flashed an ICS rom. x(

#8 Malix

Malix
  • Members
  • 5 posts
  • Twitter:malix82
  • Country:fi
  • Device Model:Desire Z
  • MOD Version:7.2 rc1
  • Recovery Image:ClockworkMod

Posted 03 January 2012 - 01:47 PM

 Crest of a Wave, on 03 January 2012 - 09:32 AM, said:

Though I'm afraid I can't do more testing on this since I flashed an ICS rom. x(

what does that prevent? o_O

#9 rohdef

rohdef
  • Members
  • 3 posts
  • Device Model:|4|
  • MOD Version:don't know
  • Recovery Image:Cyanogen

Posted 21 March 2012 - 09:21 PM

Couldn't we get this setting into the roms per default? So far it seems noone have had any problems with it, quite frankly I have a hard time to see how it can damage the device. (Apart if there's a possible dangerous typo - in which case it would be event more imortant in the defaults)

I've been using this setting for months now, actually forgot it till I installed 7.2 and dicovered that my device became VERY slow.

I would highly recommend this setting, although ofc under the usual disclaimers :P

#10 warp2

warp2
  • Members
  • 7 posts
  • Country:de
  • Device Model:HTC Desire Z
  • MOD Version:7 RC 4 or nightlys
  • Recovery Image:Cyanogen

Posted 28 April 2012 - 03:34 PM

how can i activate swap?

I made a swap-partition on sd-card
My system is CM-7.2.0-RC1 with a 2.6.35.14-cyanogenmod-g295e82fandroid@portatile#1 - kernel.

But how can i enable the swap-partition? Is there anything to change the kernel?

Edited by warp2, 29 April 2012 - 09:09 AM.


#11 rohdef

rohdef
  • Members
  • 3 posts
  • Device Model:|4|
  • MOD Version:don't know
  • Recovery Image:Cyanogen

Posted 30 April 2012 - 07:17 AM

Most likely you can open an terminal (either terminal emulator on the phone or adb shell from your computer) and run:
su
swapon /path/to/swap

I think you need to edit fstab to get it permanently working, but try to google either "cyanogenmod swap" or "android swap". I'm only using my general Linux knowledge, and there might be specifics worth knowing before experimenting.