Re: what are these processes?

Stephen C. Tweedie (sct@redhat.com)
Wed, 21 Apr 1999 19:47:02 +0100 (BST)


Hi,

On 20 Apr 1999 19:23:44 +0200, Pierfrancesco Caci
<ik5pvx@penny.ik5pvx.ampr.org> said:

> PID TTY STAT TIME COMMAND
> 2 ? SW 0:30 (kflushd)
> 3 ? SW 0:00 (kpiod)
> 4 ? SW 0:19 (kswapd)
> 13 ? S 0:05 update

> what are these processes and what do they do ?

kflushd is the thread which the kernel wakes up if it gets into a panic
about having too much dirty data in the buffer cache. Having lots of
dirty data is a problem because you cannot free it without first writing
it to disk, so if you leave it around for too long, you wil run out of
reusable memory.

Update is the mechanism which just writes back a bit of data every 5
seconds to make sure that no dirty data lasts more than a given time (5
seconds or 30 seconds depending on the data). It makes sure that even
if there is only a little dirty data in the buffer cache, it still gets
flushed to disk.

kswapd is the thread which reclaims memory from the VM subsystems when
memory gets low. We need this to make sure that even if memory is being
consumed by interrupts, we still get around to freeing more memory
(interrupts cannot clean the memory on their own: you don't want to do
heavyweight jobs like that from inside interrupts).

kpiod is a new thread, and its job is to write out dirty pages from the
page cache. We needed to separate that job out from the rest of the VM
to avoid certain deadlocks. Without kpiod, a process could perform some
filesystem operation which took out an internal lock in the filesystem
and then tried to get more memory. If the memory subsystem decided that
to free the memory it had to write back a page to disk, and that write
required the same filesystem lock, then we could easily get deadlock.
Having kpiod as a separate thread means that those page writes never
stop the rest of the VM from working.

Cheers,
Stephen.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/