Messages in this thread | | | From | Nikita Danilov <> | Date | Wed, 7 Aug 2002 13:22:51 +0400 | Subject | kernel thread exit race |
| |
Hello,
what is the politically correct way to exit from a kernel thread daemon without module unload races?
Currently most kernel threads exit with something like
wake_up(&daemon_done_wait_queue); return 0;
(or complete() in stead of wake_up()). Problem is that thread waiting for daemon shutdown can start running on another CPU while daemon is still executing and unload module, in particular unmapping page with daemon code.
Reiserfs used to do something like
/* * BKL will be released in do_exit() */ lock_kernel(); wake_up(&daemon_done_wait_queue); return 0;
and wait for daemon completion under BKL so that when waiter resumes, daemon is definitely not executing module code. This looks like a hack, though. Is there a better solution?
Nikita. - 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/
| |