2007-10-24 13:37:19

by Sriram V

[permalink] [raw]
Subject: kernel processes - are they really needed?

Hi,
When i do ps -l. i see the following processes which are obviously
started by kernel.

Could any one tell me what each of these processes do and can
anyone of them can be removed.?

PID Uid VmSize Stat Command
1 root 584 S init
2 root SWN [ksoftirqd/0]
3 root SW [watchdog/0]
4 root SW< [events/0]
5 root SW< [khelper]
6 root SW< [kthread]
23 root SW< [kblockd/0]
38 root SW [pdflush]
39 root SW [pdflush]
40 root SW< [kswapd0]
41 root SW< [aio/0]
85 root SW [mtdblockd]
116 root SWN [jffs2_gcd_mtd9]
Regards,
ram


2007-10-24 15:30:30

by linux-os (Dick Johnson)

[permalink] [raw]
Subject: Re: kernel processes - are they really needed?


On Wed, 24 Oct 2007, Ram wrote:

> Hi,
> When i do ps -l. i see the following processes which are obviously
> started by kernel.
>
> Could any one tell me what each of these processes do and can
> anyone of them can be removed.?
>
> PID Uid VmSize Stat Command
> 1 root 584 S init
> 2 root SWN [ksoftirqd/0]
> 3 root SW [watchdog/0]
> 4 root SW< [events/0]
> 5 root SW< [khelper]
> 6 root SW< [kthread]
> 23 root SW< [kblockd/0]
> 38 root SW [pdflush]
> 39 root SW [pdflush]
> 40 root SW< [kswapd0]
> 41 root SW< [aio/0]
> 85 root SW [mtdblockd]
> 116 root SWN [jffs2_gcd_mtd9]
> Regards,
> ram
> -

Init is the 'mother' of all processes. It sleeps using
no resources until some other process terminates. At
that time,...............learn about Unix somewhere else.

Other tasks are essential as well.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.59 BogoMips).
My book : http://www.AbominableFirebug.com/
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

2007-10-24 19:43:19

by Andi Kleen

[permalink] [raw]
Subject: Re: kernel processes - are they really needed?

Ram <[email protected]> writes:

> Hi,
> When i do ps -l. i see the following processes which are obviously
> started by kernel.
>
> Could any one tell me what each of these processes do

> and can anyone of them can be removed.?

Some of them can probably. Or rather many depending on the configuration.

Sometimes there are good reasons for an own thread, but often there are also
bad reasons.

If the threads don't sleep or have special requirements long they
should generally just use keventd instead.

Unfortunately a lot of people seem to think they're cheap because
it's relatively easy to create them using work queues now, so we end
up with more and more all the time.

Especially on systems with many cores or threads which end up with a
lot of dubious per CPU threads. Some scaling up is needed, but one per CPU
seems to be generally too many.

My favourite for a ridiculous thread was and is "kpsmoused"

-Andi

2007-10-31 16:01:52

by Jan Kara

[permalink] [raw]
Subject: Re: kernel processes - are they really needed?

Hi,

> When i do ps -l. i see the following processes which are obviously
> started by kernel.
>
> Could any one tell me what each of these processes do and can
> anyone of them can be removed.?
I'll write what I know :)

> PID Uid VmSize Stat Command
> 1 root 584 S init
> 2 root SWN [ksoftirqd/0]
> 3 root SW [watchdog/0]
> 4 root SW< [events/0]
> 5 root SW< [khelper]
> 6 root SW< [kthread]
> 23 root SW< [kblockd/0]
This one has something to do with block layer - like unplugging
request queue after a certain timeout etc.

> 38 root SW [pdflush]
> 39 root SW [pdflush]
Doing writeback of dirty data.

> 40 root SW< [kswapd0]
Swapping pages in and out.

> 41 root SW< [aio/0]
Kernel thread handling asynchronous IO.

> 85 root SW [mtdblockd]
> 116 root SWN [jffs2_gcd_mtd9]
jffs2 specific - ask a maintainer :) (and mtdblockd has something to
do with MTD devices so he may know that one as well).

Honza
--
Jan Kara <[email protected]>
SuSE CR Labs

2007-10-31 16:35:42

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: kernel processes - are they really needed?

On 10/24/07, Andi Kleen <[email protected]> wrote:
>
> My favourite for a ridiculous thread was and is "kpsmoused"
>

Mouse querying can take significant amount of time. Do you really want
all your other events to be delayed just because kernel tries to get
mouse back in order?

Although I probably want to kill it if mouse resync is disabled...

--
Dmitry

2007-10-31 17:11:00

by Matthias Kaehlcke

[permalink] [raw]
Subject: Re: kernel processes - are they really needed?

El Wed, Oct 31, 2007 at 05:01:42PM +0100 Jan Kara ha dit:

> > When i do ps -l. i see the following processes which are obviously
> > started by kernel.
> >
> > Could any one tell me what each of these processes do and can
> > anyone of them can be removed.?
> I'll write what I know :)

i'll also put my 0.5 cents :)

> > PID Uid VmSize Stat Command
> > 1 root 584 S init
> > 2 root SWN [ksoftirqd/0]

executes (on CPU 0) the deferred parts of interrupt routines (bottom
halves), i.e. softirqs and tasklets. bad candidate for removal imo

> > 3 root SW [watchdog/0]
> > 4 root SW< [events/0]

this one is in charge of executing deferred functions placed in the
default work queue. also a bad candidate for removal

> > 5 root SW< [khelper]
> > 6 root SW< [kthread]
> > 23 root SW< [kblockd/0]
> This one has something to do with block layer - like unplugging
> request queue after a certain timeout etc.
>
> > 38 root SW [pdflush]
> > 39 root SW [pdflush]
> Doing writeback of dirty data.
>
> > 40 root SW< [kswapd0]
> Swapping pages in and out.
>
> > 41 root SW< [aio/0]
> Kernel thread handling asynchronous IO.
>
> > 85 root SW [mtdblockd]
> > 116 root SWN [jffs2_gcd_mtd9]
> jffs2 specific - ask a maintainer :) (and mtdblockd has something to
> do with MTD devices so he may know that one as well).

--
Matthias Kaehlcke
Linux Application Developer
Barcelona

If you don't know where you are going,
you will probably end up somewhere else
(Laurence J. Peter)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-

2007-10-31 17:33:19

by Andi Kleen

[permalink] [raw]
Subject: Re: kernel processes - are they really needed?

"Dmitry Torokhov" <[email protected]> writes:

> On 10/24/07, Andi Kleen <[email protected]> wrote:
>>
>> My favourite for a ridiculous thread was and is "kpsmoused"
>>
>
> Mouse querying can take significant amount of time. Do you really want
> all your other events to be delayed just because kernel tries to get
> mouse back in order?

How long?

>
> Although I probably want to kill it if mouse resync is disabled...

How often does that happen? Can't you just start a thread for this
as needed? Or if it's a simple algorithm you can just use a state machine
using timers?

-Andi

2007-11-02 01:51:48

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: kernel processes - are they really needed?

On Wednesday 31 October 2007 13:33, Andi Kleen wrote:
> "Dmitry Torokhov" <[email protected]> writes:
>
> > On 10/24/07, Andi Kleen <[email protected]> wrote:
> >>
> >> My favourite for a ridiculous thread was and is "kpsmoused"
> >>
> >
> > Mouse querying can take significant amount of time. Do you really want
> > all your other events to be delayed just because kernel tries to get
> > mouse back in order?
>
> How long?

If a mouse is stubborn and does not want to get enabled it may sleep
up to 1 sec.

>
>
> >
> > Although I probably want to kill it if mouse resync is disabled...
>
> How often does that happen? Can't you just start a thread for this
> as needed? Or if it's a simple algorithm you can just use a state machine
> using timers?
>

The IRQ handler is already too complex, I'd rather not mess with a state
machine. I will see how to kill the thread if resync is disabled.

--
Dmitry