For the past few weeks, my home server has experienced bouts of extremely high CPU usage courtesy of kswapd0. This came as quite a surprise to me since none of the software on my server is particularly resource-intensive. KSysGuard says as much; as I type this, it shows RAM usage as sitting at just under 1 GB, and I’ve got 4 GB installed. However, it also shows that 1.1 GB of swap space is being used.
To make matters even more confusing, I used the command-line tool top to double-check RAM usage, and it paints a completely different picture:
top - 17:00:14 up 1 day, 9:22, 4 users, load average: 3.32, 2.61, 2.14
Tasks: 158 total, 2 running, 155 sleeping, 0 stopped, 1 zombie
%Cpu(s): 6.7 us, 72.0 sy, 0.0 ni, 1.0 id, 19.2 wa, 0.0 hi, 1.1 si, 0.0 st
KiB Mem: 3938232 total, 3786688 used, 151544 free, 1032 buffers
KiB Swap: 4075516 total, 1181264 used, 2894252 free, 2953960 cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
34 root 20 0 0 0 0 D 80.5 0.0 226:44.13 kswapd0
638 root 20 0 176m 20m 8292 R 48.9 0.5 11:19.97 Xorg
461 sickbea+ 20 0 1279m 66m 2196 S 16.3 1.7 114:08.57 python
12331 honor 20 0 488m 17m 7748 S 3.7 0.5 0:44.75 ksysguard
1635 honor 20 0 701m 21m 6132 S 2.3 0.5 8:03.55 kwin
2459 honor 20 0 265m 11m 4048 S 2.0 0.3 1:01.08 krfb
1593 root 20 0 0 0 0 D 1.7 0.0 1:51.23 flush-8:16
1747 honor 20 0 1203m 58m 10m S 0.7 1.5 13:03.42 plasma-desktop
11 root 20 0 0 0 0 S 0.3 0.0 1:36.69 rcu_preempt
177 root 0 -20 0 0 0 S 0.3 0.0 2:09.07 kworker/0:1H
464 sabnzbd 20 0 1492m 9600 2104 S 0.3 0.2 3:13.91 SABnzbd.py
2782 honor 20 0 1007m 27m 8704 S 0.3 0.7 7:40.14 ktorrent
1 root 20 0 46072 3340 848 S 0.0 0.1 0:01.18 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:08.96 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0H
8 root rt 0 0 0 0 S 0.0 0.0 0:00.10 migration/0
9 root -2 0 0 0 0 S 0.0 0.0 0:15.35 rcuc/0
10 root -2 0 0 0 0 S 0.0 0.0 0:00.00 rcub/0
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_sched
14 root rt 0 0 0 0 S 0.0 0.0 0:00.40 watchdog/0
15 root rt 0 0 0 0 S 0.0 0.0 0:00.39 watchdog/1
16 root -2 0 0 0 0 S 0.0 0.0 0:11.24 rcuc/1
17 root 20 0 0 0 0 S 0.0 0.0 0:09.02 ksoftirqd/1
18 root rt 0 0 0 0 S 0.0 0.0 0:00.12 migration/1
20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H
21 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset
22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
23 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
25 root 20 0 0 0 0 S 0.0 0.0 0:00.01 bdi-default
26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd
27 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd
28 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff
29 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khubd
30 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 md
33 root 20 0 0 0 0 S 0.0 0.0 0:00.02 khungtaskd
35 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
36 root 39 19 0 0 0 S 0.0 0.0 0:00.69 khugepaged
37 root 20 0 0 0 0 S 0.0 0.0 0:00.00 fsnotify_mark
38 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto
43 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kthrotld
44 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kpsmoused
46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq
83 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0
84 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1
85 root 20 0 0 0 0 S 0.0 0.0 0:00.78 kworker/u:2
87 root 20 0 0 0 0 S 0.0 0.0 0:00.01 scsi_eh_2
88 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_3
99 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kmpath_rdacd
246 root 20 0 0 0 0 S 0.0 0.0 0:29.98 jbd2/sda1-8
247 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ext4-dio-unwrit
254 root 20 0 0 0 0 S 0.0 0.0 0:05.55 flush-8:0
273 root 0 -20 0 0 0 S 0.0 0.0 0:03.49 kworker/1:1H
280 root 20 0 591m 11m 11m S 0.0 0.3 0:14.51 systemd-journal
281 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kauditd
312 root 20 0 39108 496 492 S 0.0 0.0 0:00.05 systemd-udevd
358 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/43-mei
378 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kvm-irqfd-clean
386 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 hd-audio0
401 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 led_workqueue
443 root 20 0 0 0 0 S 0.0 0.0 0:01.54 jbd2/sda3-8
444 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ext4-dio-unwrit
If I’m reading this correctly, top is saying that RAM usage is almost maxed out. What’s going on here? How can I get kswapd0 under control? I did a search for similar topics, but the kernel bug talked about in earlier threads was supposedly fixed.