Hi Cheng... > Thanks in advance! > Yes, it is sys_execve() in deed. Hm... ok :) > Since the mm struct of kernel thread is borrowed, where we get > the user thread's mm struct? Duplicate the borrowed mm struct? Ehm, nope. Pay attention on the following code (taken from context_switch() in kernel/sched.c on 2.4.20-19.9 a.k.a Redhat 9 stock kernel): --------------------------------------------------------------------------------- if (unlikely(!mm)) { next->active_mm = oldmm; atomic_inc(&oldmm->mm_count); --------------------------------------------------------------------------------- Thus, what you see there is, the "mm" field of the kernel thread is still NULL, but the "active_mm" property is assigned the address of oldmm, where oldmm is declared as: struct mm_struct *oldmm = prev->active_mm both "next" and "prev" are task_struct type pointers. The first one refers to the task that will be selected by the scheduler, while the latter one refers to the current task (that will be replaced by "next"). The conclusion is, the "mm" property is not duplicated. > My another question is how kernel thread switch to user thread? > Is the sys_execve() construct the user mode registers? Hm, I am not sure if I understand the above question correctly. Could you elaborate please? regards, Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/