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.

Memory usage by day

Swap in/out by day

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:

enter image description here

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.

enter image description here

The root cause seems to be AMD's ATI fglrx driver (Catalyst) for radeon (Radeon Mobility HD 3650 in my case).

  • What program did you use to make those graphs? They are extremely useful.
    – nanofarad
    Nov 4 '12 at 19:10
  • 1
    @ObsessiveSSOℲ: this is Munin (munin-monitoring.org). In order to use it with Debian/Ubuntu apt-get install munin munin-node. munin-node is the package that actually collects the data, and munin is a "server application" that can collect data of multiple nodes. The simplest setup: only from localhost. Ubuntu places the outcome in /var/cache/munin/www/.
    – mdo
    Nov 4 '12 at 19:33
  • Good puzzle. I wonder if there's a way to audit the values of distress and mapped_ratio.
    – ændrük
    Nov 9 '12 at 22:45
  • @ændrük: I looked at the topic you linked but found no way to monitor these values so far. However I now tried a shot into the dark and changed vm.overcommit_memory from the default 0 to 2. Restarting the IDE after that resulted in committed memory jumping up to above 7 GB. I'm looking at the behaviour for the next few days since the swap orgy does not happen on every standby-poweron-cycle. Thanks for your input.
    – mdo
    Nov 13 '12 at 7:40

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.


Unity does not start after installing the fglrx drivers

I hope this goes some way in assisting you. At your own risk.

  • ATI is correct, will check this in the next few days.
    – mdo
    Nov 20 '12 at 9:20
  • Probably this was the root cause. I disabled the discrete ATI card via BIOS and am now running on the integrated Intel chipset, albeit with reduced eye-candy due to missing glx support. The swap-out did not happen for a few days now. I installed the latest ATI driver a few months ago (did run Intel before), downloaded it directly from AMD.
    – mdo
    Nov 24 '12 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.