Re: [ham] Re: Gracefully killing kswapd, or any kernel thread

From: linux-os (Dick Johnson)
Date: Fri Sep 09 2005 - 14:21:31 EST



On Fri, 9 Sep 2005, Kristis Makris wrote:

> On Wed, 2005-09-07 at 18:36 -0400, linux-os (Dick Johnson) wrote:
>> On Wed, 7 Sep 2005, Kristis Makris wrote:
>>
>>>> To kill a kernel thread, you need to make __it__ call exit(). It must be
>
> I was able to make it call do_exit(). However, even if I recompile a
> kernel to have kswapd issued a do_exit(), I still see from ps:
>
> root 4 0.0 0.0 0 0 ? Z 06:20 0:00 [kswapd
> <defunct>]
>
> Why isn't the task_struct for it gone ?
>

Because it's now defunct <Z>, a zombie, waiting for somebody to
reap its return status. You are almost there, you need to issue
the kernel equivalent of waitpid() (sys_waitpid) to grab that
status and throw it away. That's what the code I showed you
did when it would shut down and remove a module that had
a kernel thread.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13 on an i686 machine (5589.53 BogoMips).
Warning : 98.36% of all statistics are fiction.
.
I apologize for the following. I tried to kill it with the above dot :

****************************************************************
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 DeliveryErrors@xxxxxxxxxxxx - and destroy all copies of this information, including any attachments, without reading or disclosing them.

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