Hi Rob... On Thu, Jun 14, 2012 at 7:03 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
(what is probably the first in a plethora of silly questions as i dig into the ugly details of various kernel features. you've been warned.)
clawing my way through the kernel code for kthreads and i notice the following. in kernel/kthread.c, we have:
===
struct kthread { int should_stop; void *data; struct completion exited; };
#define to_kthread(tsk) \ container_of((tsk)->vfork_done, struct kthread, exited)
perhaps because somehow kernel thread in some ways are treated like normal vfork()? the way I see it is this: kernel thread borrows previously running mm_struct. In this scope, if somehow the real owner mm_struct is going to be destroyed, it must wait for the borrower (kernel thread) to finish first. Maybe this is where that vfork_done<-->exited correlation is used. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com