lkml.org 
[lkml]   [2005]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Stopping Kernel Threads at module unload time
Thank you very much Arnd!
You solved my problem. hehe

I began to write a test module for showing you this and have just
realized about the problem. As I create as many threads as CPUs, I
have to delete them all when finishing.

I killed them like this:

/* We don't need the distraction of CPUs appearing and vanishing. */
lock_cpu_hotplug();
for_each_online_cpu(cpu) {
p = per_cpu(ksensord_info, cpu);
kthread_stop(p);
}
unlock_cpu_hotplug();

I locked the cpu hotplug lock to protect the for_each_online_cpu()
code in case a cpu appears/vanishes, so I am actually calling
kthread_stop() in an atomic context, so it wakes up the process, but
dont let it run!

This is quite a subtle error, but of course it's my complete fault :P
May be a BUG_ON(in_atomic()) within kthread_stop() would let this kind of
errors be acknowledged more easily.

Thank you for your help
Regards

Aritz Bastida

PS: Sorry Arnd, I forgot adding the linux-kernel address to the message
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-11-09 18:56    [W:0.046 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site