From: Andrew Morton <akpm@zip.com.au>
To: Alan Stern <stern@rowland.org>
Cc: linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: Daemonize() should re-parent its caller
Date: Wed, 23 Jan 2002 11:46:45 -0800 [thread overview]
Message-ID: <3C4F1325.C65001EE@zip.com.au> (raw)
In-Reply-To: <Pine.LNX.4.33L2.0201231050440.687-100000@ida.rowland.org>
Alan Stern wrote:
>
> Consider the question: what happens when a kernel thread dies? For
> the most part this doesn't come up, since most kernel threads stay
> alive as long as the system is up. But when a kernel thread dies, the
> same thing happens as with any other thread: it becomes a zombie, and
> its exit_signal (if any) is posted to its parent.
>
> ...
>
> But a more elegant and economical solution is to have the daemonize()
> routine automatically re-parent its caller to be a child of init
> (assuming the caller's parent isn't init already). At the same time,
> the caller's exit_signal should be set to SIGCHLD. This would
> definitely solve the problem, and it is unlikely to introduce any
> incompatibilities with existing code.
>
Yes. There's a function in the 2.4 series called reparent_to_init()
whch does this. Typically a kernel thread will call that immediately
after calling daemonize(). It _should_ solve any problem which you're
observing. Could you please test that, and if it fixes the problem
which you're seeing, send a patch to the USB maintainers?
Perhaps we should unconditionally call reparent_to_init() from within
daemonize(). I wimped out on doing that because of the possibility
of strangely breaking something.
Really, an audit of all callers of kernel_thread() is needed, and
most of them should would end up using reparent_to_init(). Difficult
to do in the 2.4 context, so we should only do this when and where
problems are demonstrated.
(But you Cc'ed Alan. Are you using 2.2.x?)
-
next prev parent reply other threads:[~2002-01-23 19:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-23 15:54 Daemonize() should re-parent its caller Alan Stern
2002-01-23 19:46 ` Andrew Morton [this message]
2002-01-23 20:28 ` Alan Stern
2002-01-23 20:58 ` Greg KH
2002-01-23 21:18 ` Matthew Dharm
2002-01-27 19:48 ` 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=3C4F1325.C65001EE@zip.com.au \
--to=akpm@zip.com.au \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=stern@rowland.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.