Re: is reparent_to_init a good thing to do?

Andrew Morton
2001-10-09T16:14:22Z

BALBIR SINGH wrote:
>
> I was looking at the driver under drivers/net/8139too.c, a kernel
> thread rtl8139_thread is created, it calls daemonize() and soon
> afterwards calls reparent_to_init(). Looking at reparent_to_init(),
> it looks like all kernel threads should do this. But, I feel I am missing
> something, since not everybody does this.
>
> Is this a good thing to do? or are there special cases when we need this.
>

I think yes, more kernel threads need to use this function. Most
particularly, threads which are parented by a userspace application
and which can terminate. For example, the nfsd threads.

Right now, it's probably the case that nfsd threads will turn
into zombies when they terminate, *if* their parent is still
running. But of course, most kernel threads are parented
by very short-lived userspace applications, so nobody has
ever noticed.