I'm running on 4G RAM with an extra 6G swap partition, SSD is a pretty decent SAMSUNG MZMPA128HMFU model. System responds very well to workloads when things stay in RAM, but as soon as things reach the swap partition in any meaningful quantity (let say 1GB+ swap used), responsiveness goes completely down the drain during swapping episodes. SSD light stays on for several seconds while apparently loads of stuffs get paged in or out, during this all other IO is blocked. I've seen system load jump from 0.8 to 10 in a few seconds, then drop back down as IO gets going again. When swap is in active use (I keep a bunch of big apps open) these gagging swap episodes happen more and more often as uptime increases (at 26 days now).

I am looking at latencytop, but it isn't telling me much I could go on.

There seems to be no other solution at this point than stop enough apps to be able to do swapoff -a and just stop using swap. Not sure how this affects my usage patterns, I'm almost certain it's going to be enough for the set of apps I regularly run.

Turning vm.swappiness down to 1 doesn't help things. At least not by itself.

Is this some well known thing? What are my options to have decent desktop responsiveness while using virtual memory?

  • 7
    Using swap unnecessarily is very very silly. If you constantly need to use swap for very active material, you need more RAM. An SSD is orders of magnitude slower than real memory, even though it is noticeably faster than a spinning platter.
    – goldilocks
    Dec 22, 2012 at 15:25
  • 2
    Not sure where this "unnecessarily" came from. I run my apps to do real work. Are you saying using swap on Linux is supposed to lock up the system like this by kernel or scheduler design?
    – lkraav
    Dec 22, 2012 at 15:37
  • No, he's saying that apparently you have too little memory in your system to perform your tasks. If your workload requires significantly more memory than you have, you're simply in a world of pain.
    – marcelm
    Feb 9, 2019 at 2:10
  • That being said, not all SSDs are created equal. Some, especially older and cheaper ones, can be horribly slow. I had an SSD in my workstation, and as soon as it had to do any non-trivial I/O (say 10-20MB/s), it would make Linux unworkable. Now I have a new SSD (decent, but nothing special) and everything works great, even under I/O load.
    – marcelm
    Feb 9, 2019 at 2:13

2 Answers 2


I'd strongly suggest getting more memory installed so that you are not swapping. Any swapping just KILLS the performance of a Linux or UNIX(tm) system. So install enough memory to stop the swap!

  • 2
    Right, but this doesn't explain the technical background of the issue. For example, having used OS X up to Snow Leopard for several years, I did not experience this sort of behavior under similar usage patterns and conditions. How is Linux weaker here?
    – lkraav
    Dec 22, 2012 at 20:44
  • @lkraav the technical background is prety much the data transfer speed: RAM is of the order GB/s, SSD is at least one order below that (plus you need to both write and read it). Hence once you hit swap and the system just tries to move the needed pages into RAM as quickly as possible don't be surprised it's not responding as quickly as swapping. And if you jump from one application into another, it will just make things worse.
    – peterph
    Dec 22, 2012 at 21:32
  • 1
    Similar hardware with similar workload will give you similar performance degration on any platform (Windows, OSX, Linux, Unix, ...). Either you are comparing two different situations or your hardware is malfunctioning.
    – jippie
    Dec 23, 2012 at 11:27
  • 2
    I have a feeling that with memory being quite cheap these days there is not the motivation among the kernel developers to improve swapping behavior. It is just not a high priority to them.
    – mdpc
    Apr 18, 2013 at 21:10
  • 1
    Mid-2015 update: 16GB is still mostly enough for everything I'm doing these days. Whenever I hit swap now, it's an immediate signal that an app is buggy and leaking memory and htop confirms it every time. Which is why the XPS13 2015 with infinity display is a beautiful thing, but 8GB max RAM is just not OK.
    – lkraav
    May 17, 2015 at 15:01

If your workload really needs more than 6GB of active RAM, then you're not really going to be able to tune anything to make it run faster while swapping.

Some light swap usage isn't necessarily a problem - my 3GB laptop has been running for about 30 days and is using 600MB of swap (on a spinning hard disk, not an SSD), but it's running fine - since only inactive pages have been swapped out so pages rarely (if ever) need to be swapped back in.

If you can't add more RAM to your system, then the next best thing is to look to see which processes are using so much RAM and see if you can eliminate them or do something to reduce their RAM usage. The "top" command is useful for this, just use the "M" command to sort by memory usage.

  • 1
    You are confusing paging with swapping. Paging is quite normal (i.e. taking out memory pages that are inactive or not being used into swap space) whereas swapping involves moving an entire process out of memory onto the swap disk. Swapping is only done if the paging process does not provide the required amount of memory needed.
    – mdpc
    Apr 19, 2013 at 20:29
  • Modern VM based operating systems don't do what was historically called "swapping" -- swapping entire process address spaces in/out to secondary storage. They all do paging to what is still called a swap file. Thus, many people use the terms interchangeably. The more correct term would probably be "page swapping" (as opposed to just "paging", which could be confused with MMU page mapping).
    – Johnny
    Apr 19, 2013 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .