Re: is a task_struct vfork_done completion special only for kthreads?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rob...

On Thu, Jun 14, 2012 at 7:03 PM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux