mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* kernel thread exit race
@ 2002-08-07  9:22 Nikita Danilov
  2002-08-07  9:38 ` Russell King
  2002-08-07 11:18 ` Alan Cox
  0 siblings, 2 replies; 8+ messages in thread
From: Nikita Danilov @ 2002-08-07  9:22 UTC (permalink / raw)
  To: Linux Kernel Mailing List

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-08-07 12:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-07  9:22 kernel thread exit race Nikita Danilov
2002-08-07  9:38 ` Russell King
2002-08-07 11:18 ` Alan Cox
2002-08-07 10:05   ` Nikita Danilov
2002-08-07 12:11     ` Alan Cox
2002-08-07 11:30       ` Nikita Danilov
2002-08-07 12:12         ` Russell King
2002-08-07 13:22         ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®