Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had been running a demo system on Linux with the following kernel:

2.6.32-400.1.1.el5uek #1 SMP Mon Jun 25 20:25:08 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

And as soon as swap happens, the CPU usage on the system goes up to almost 100% busy, among which around 90% is sys CPU usage. I was told that it's expected because the Linux page daemon kicks in and starts writing the memory chunk to swap only when running out of memory(or, free memory is less than 0.5G), which results in a lot of sys CPU usage. "swappiness" is 60 on the system.

Is it expected behavior that the CPU usage goes to 100% when swap happens on Linux?

The reason why I had the above question is, the above behavior has changed when I migrate the demo to another system with the following Linux kernel:

2.6.39-400.128.14.el5uek #1 SMP Sat May 10 00:06:52 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux

The only difference of the vm parameter on the migrated system I noticed is the min_free_kbytes parameter, changed to 524288 on the migrated system vs 51200 in the pre-migrated system.

On the migrated system, when the free memory reaches less than 1.5G, swap happens, then the CPU usage goes up a little bit, something like from 30% to 40%, and the application performance got erratic only for a short period and then everything goes back to normal as before swap happens.

What makes the migrated system behave so different, that CPU usage won't go up to 100% busy when swap happens?

It's a very important demo system and the explanation of the above two questions will be very useful. Any ideas will be very much appreciated.

share|improve this question
Can you give some detail about the hardware? I commonly wouldn't expect 100% use as soon as swapping starts. If you swap out large chunks to slow disk, however, it may occur. – tink Jul 24 '14 at 4:17
The pre-migrated hardware is Oracle Exadata X3-2:… , the migrated hardware is Oracle Exadata X4-2:… . 100% usage happens usually after seconds after swapping starts on X3-2 and then the CPU usage usually stays in the 100% level – Christine Qu Jul 24 '14 at 4:43
Those are marketing blurbs :) ... what are the actual specs of yours, what kind of I/O subsystem do yours have? That said: I'd expect there to be something seriously wrong if an enterprise level machine starts swapping, and uses 100% CPU when doing so. – tink Jul 24 '14 at 20:38
I have the same problem with Linux 4.0.4-2-ARCH. 2GB RAM, swapping to an SSD. FYI, the kernel process using CPU is kswapd. – Zaz Jun 1 '15 at 22:34

You must log in to answer this question.

Browse other questions tagged .