Skip to contentSkip to conversation

kswapd0 inefficient?

DISCUSSION Richard Jelinek 2 participants 2 messages Oct 18, 2007

lore
Share & tools
lore
#0 lore raw

Hello guys,

I'm not subscribed to this list, so if you find this question valid enough to answer it, please cc me. Thanks.

This is what the top-output looks like on my machine after having copied about 550GB of data from a twofish256 crypted disk to a raid array:
--------------

Mem:   8178452k total,  8132180k used,    46272k free,  2743480k buffers
Swap:        0k total,        0k used,        0k free,  4563032k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

 5954 root       0 -20     0    0    0 R   62  0.0  96:42.61 loop0
 6014 root      18   0 23744  19m  484 R   20  0.2  25:45.31 cp
  255 root      10  -5     0    0    0 S    8  0.0  10:21.82 kswapd0
 6011 root      10  -5     0    0    0 D    6  0.0   4:15.66 kjournald

...yadda yadda...
--------------

And what do we see here? We see loop0 and cp eating up some time. That's ok for me considered the work they do. kjournald is also ok for me, but I ask myself: why the heck has kswapd0 crunched 10+ minutes of CPU time?

I mean what does kswapd0 do?
http://www.linuxforums.org/forum/linux-kernel/65380-what-does-kswapd0-do.html

And I have no swap - right? So it should just shut up - IMHO. Or am I missing something?

kind regards,
Marcel

#1 lore raw
Quoted 25 lines · Richard Jelinek

Hello guys,

I'm not subscribed to this list, so if you find this question valid enough to answer it, please cc me. Thanks.

This is what the top-output looks like on my machine after having copied about 550GB of data from a twofish256 crypted disk to a raid array:
--------------

Mem:   8178452k total,  8132180k used,    46272k free,  2743480k buffers
Swap:        0k total,        0k used,        0k free,  4563032k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

 5954 root       0 -20     0    0    0 R   62  0.0  96:42.61 loop0
 6014 root      18   0 23744  19m  484 R   20  0.2  25:45.31 cp
  255 root      10  -5     0    0    0 S    8  0.0  10:21.82 kswapd0
 6011 root      10  -5     0    0    0 D    6  0.0   4:15.66 kjournald

...yadda yadda...
--------------

And what do we see here? We see loop0 and cp eating up some time. That's ok for me considered the work they do. kjournald is also ok for me, but I ask myself: why the heck has kswapd0 crunched 10+ minutes of CPU time?

Quoted 6 lines

I mean what does kswapd0 do?
http://www.linuxforums.org/forum/linux-kernel/65380-what-does-kswapd0-do.ht
ml

And I have no swap - right? So it should just shut up - IMHO. Or am I missing something?

kswapd also reclaims pagecache, not just anonymous memory. It runs in response to memory pressure and if it wasn't around, then all your apps requesting memory would have to do basically the same amount of work themselves.