Re: Stopping Kernel Threads at module unload time

From: linux-os (Dick Johnson)
Date: Wed Nov 09 2005 - 12:05:22 EST



On Wed, 9 Nov 2005, Aritz Bastida wrote:

> Hello,
>
>> This is how the kernel thread is stopped.
>>
>> if(info->pid)
>> {
>> (void)kill_proc(info->pid, SIGTERM, 1);
>> wait_for_completion(&info->quit);
>> }
>>
>
> I actually would prefer to do it with the new kernel thread API.
> So, to create the thread: kthread_create
> bind it to a cpu: kthread_bind
> stop it: kthread_stop
>

Sure your original question was about how to properly stop
a kernel thread prior to module removal. This, I showed you.
Now you say you "prefer" to do it some other way. Good luck.
Unless your code runs exactly like the prototype that the
new macros were written for, you may have fix the macros.

> Now, if I call kthread_stop() in module unload time, does that code
> run in user process context just like system calls do? That is
> important, because if it cannot sleep, it would deadlock.
>

Not relevent. You have apparently made up your mind that you
need to do it "your" way. Fine.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.55 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
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/