2003-08-17 23:10:33

by Duraid Madina

[permalink] [raw]
Subject: kswapd is having a party

My question for today: does anyone know what kswapd actually does?

This morning, my workstation (linux ia64 2.6.0-test3) was fairly lightly
loaded:

08:28:50 up 2 days, 1:49, 4 users, load average: 1.77, 1.79, 1.20
Mem: 2062032k total, 1916368k used, 145664k free, 119952k buffers
Swap: 2016112k total, 1984k used, 2014128k free, 697920k cached

As you can see, there was gobs of RAM I wasn't using.

Anyway, as I was enjoying my tasty breakfast cereal, I noticed kswapd
decided to wake up and say hello:

29109 duraid 25 0 400m 394m 6272 R 95.0 19.6 3:07.09 lsh
29108 duraid 19 0 404m 399m 6272 R 48.3 19.8 3:15.89 lsh
13 root 15 0 0 0 0 R 17.2 0.0 0:26.47 kswapd0

29148 duraid 25 0 400m 394m 6272 R 93.9 19.6 3:13.23 lsh
29147 duraid 20 0 404m 399m 6272 S 21.1 19.8 3:12.16 lsh
13 root 15 0 0 0 0 R 18.1 0.0 0:38.02 kswapd0

29148 duraid 25 0 400m 394m 6272 R 75.9 19.6 5:32.66 lsh
29147 duraid 18 0 404m 399m 6272 S 62.0 19.8 4:08.49 lsh
13 root 16 0 0 0 0 R 16.4 0.0 0:50.08 kswapd0

29147 duraid 25 0 404m 397m 6272 R 93.9 19.7 6:23.87 lsh
29148 duraid 25 0 400m 392m 6272 R 75.4 19.5 9:00.72 lsh
13 root 15 0 0 0 0 R 21.0 0.0 1:03.84 kswapd0

It seems I can make kswapd use fairly nontrivial amounts of CPU time by
running a perfectly innocent userland program. lsh is a raytracer I'm
starting to work on. It's a standard C program, which uses MPI (I'm
using LAM 7.0). The parallelism is trivial - each process renders a
section of the image (divided vertically), line-at-a-time. The imbalance
in CPU time between the processes is due to some sections of the scene
being less interesting than others and finishing more quickly.

Does anyone have _any_ idea what kswapd might actually be doing? I
checked: not a single page was swapped in our out througout the duration
of this test. Is there a chance that spinning on some lock (I have no
idea how LAM does its synchronization), or perhaps even just idling,
might be counted as kswapd0?

Curious,

Duraid

Attached: a snap of gkrellm. the light blue is kswapd, the dark blue is
my program, the black is idle time.


Attachments:
kswapd.png (1.42 kB)

2003-08-18 00:31:54

by William Lee Irwin III

[permalink] [raw]
Subject: Re: kswapd is having a party

On Mon, Aug 18, 2003 at 09:10:15AM +1000, Duraid Madina wrote:
> Does anyone have _any_ idea what kswapd might actually be doing? I
> checked: not a single page was swapped in our out througout the duration
> of this test. Is there a chance that spinning on some lock (I have no
> idea how LAM does its synchronization), or perhaps even just idling,
> might be counted as kswapd0?

I'd look for dirty memory; kswapd does do some page cleaning, though
pdflush is supposed to do most of it.


-- wli

2003-08-18 00:39:14

by William Lee Irwin III

[permalink] [raw]
Subject: Re: kswapd is having a party

On Mon, Aug 18, 2003 at 09:10:15AM +1000, Duraid Madina wrote:
>> Does anyone have _any_ idea what kswapd might actually be doing? I
>> checked: not a single page was swapped in our out througout the duration
>> of this test. Is there a chance that spinning on some lock (I have no
>> idea how LAM does its synchronization), or perhaps even just idling,
>> might be counted as kswapd0?

On Sun, Aug 17, 2003 at 05:33:00PM -0700, William Lee Irwin III wrote:
> I'd look for dirty memory; kswapd does do some page cleaning, though
> pdflush is supposed to do most of it.

Also, please log vmstat and take regular snapshots of /proc/vmstat.


-- wli