Swap, Swapiness and Standby: swapping starts when waking up
I'm running Ubuntu 12.04 on a Lenovo W500 (Core2Duo T9400, 4GB Ram)
Current kernel: 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux -- but the problems exists since a couple of months, surviving quite a few software (includig kernel) updates
I regularly put my machine into suspend-to-ram (S3) and when the machine comes back up Ubuntu starts to swap out processes. I was able to observe that the used swap-space starts to grow right after the box returns. See munin graphs below, the gap (obviously) shows the timeframe in STR.
Needless to say that the box becomes unusable while swapping, load goes up beyond 10.
What I've done so far:
- lowered swappiness from default (60) to 10 (via /etc/sysctl.conf: vm.swappiness=10) -- this has improved the situation much, but sometimes the problem comes back, I have not found a trigger (like memory usage) for this for now
- lowered swappiness to 5 -- perhaps this has brought an improvement again
Before going to STR the box ran stable without (swapping) problems for hours. Today when the issue showed up again I used this script (-> https://stackoverflow.com/questions/479953/how-to-find-out-which-processes-are-swapping-in-linux) to find what processes have the most used swap space. The result after the swap orgy is like that (all PIDs with more than 10M usage):
Overall swap used: 2121344 kB ======================================== kB pid name ======================================== 439520 17491 java 208148 22719 firefox 136640 4337 /usr/bin/quodli 120852 5271 chrome 81832 5264 chrome 74284 17003 chrome 65368 16960 chrome 57088 3675 chrome 56184 30923 chrome 54412 11331 chrome 54264 3878 chrome 51508 18382 chrome 50088 3163 zeitgeist-fts 49772 15543 chrome 41344 15355 compiz 35040 1161 mysqld 32124 18374 chrome 30940 11339 chrome 30044 5752 chrome 28780 4235 plugin-containe 24576 31246 empathy-chat 23840 17703 chrome 22512 3207 ubuntuone-syncd 21588 1937 ntop 18336 2021 asterisk 17200 3915 chrome 13964 1935 Xorg 12036 10679 chrome 11104 30782 empathy 11056 2889 python 10932 16565 knotify4
The java instance at the top is IntelliJ. IntelliJ, Firefox and Chrome also were all used right before the box was put to STR.
So my question is: can I somehow prevent these swapouts AND why do they happen? Is it perhaps related to some misidentification of idle processes?
I'm not looking for resolutions like:
- turn off swap
- buy more RAM
Thanks in advance!
EDIT: Further progression of memory usage, same day, broadly using the same apps all the time:
EDIT2 (resolved): I disabled my discrete ATI card in the evening of Nov. 20th and rebooted. The swap usage then dropped (see the missing red area in the Munin graph) and did not reappear since then while the box did a couple of suspend/fully-on-cycles.
The root cause seems to be AMD's ATI fglrx driver (Catalyst) for radeon (Radeon Mobility HD 3650 in my case).
- https://bugs.launchpad.net/ubuntu/+source/linux/+bug/391628
I suspect that your Lenevo uses an ATI graphics card. Although I am not certain that it is the graphics card that is causing your problem, the following may be useful reading in order of listing.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/391628
Unity does not start after installing the fglrx drivers
I hope this goes some way in assisting you. At your own risk.