What kswapd is doing when there is no swap

3

The top look like this:

KiB Mem :  3989652 total,    30976 free,  1480440 used,  2478236 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2276236 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND      
 3989 root      20   0   51680   3160   1288 D  19.8  0.1  13:13.86 mc           
 5949 root      20   0       0      0      0 D   3.6  0.0  41:33.92 [usb-storage]
  667 root      20   0       0      0      0 S   1.0  0.0   8:37.38 [kswapd0]    

I turned off swap intentionally. The output like above was captured several minutes after the "KiB Swap total" turned 0. There is a running process which copies from NFS share to USB hard drive (that is mc)

kswapd keep using around 1% of CPU time. Why?

Nikita Kipriyanov

Posted 2016-03-09T07:13:42.273

Reputation: 505

Answers

9

Many processes have memory that is backed by a file. This data can be swapped to the file even if you don't have swap space.

See: AskUbuntu » Why is kswapd0 running on a computer with no swap?

Zaz

Posted 2016-03-09T07:13:42.273

Reputation: 1 843

1In other words, kswapd serves not only RAM extension aka "the swap", but also mmap and other memory paging related features in linux. – Nikita Kipriyanov – 2016-09-14T05:57:49.187

@NikitaKipriyanov: That's right. – Zaz – 2016-09-16T07:25:47.263