mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikita Danilov <Nikita@Namesys.COM>
To: Linux Kernel Mailing List <Linux-Kernel@Vger.Kernel.ORG>
Subject: kernel thread exit race
Date: Wed, 7 Aug 2002 13:22:51 +0400	[thread overview]
Message-ID: <15696.59115.395706.489896@laputa.namesys.com> (raw)

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.

             reply	other threads:[~2002-08-07  9:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-07  9:22 Nikita Danilov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15696.59115.395706.489896@laputa.namesys.com \
    --to=nikita@namesys.com \
    --cc=Linux-Kernel@Vger.Kernel.ORG \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®