Re: Re: How does kernel thread create user process?

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

 



Hi...

Sorry, replying late...

> I meaned that how a kernel thread create a user thread. For example,
> the device drivers can call call_usermodehelper() to create a user
> thread.

Well, it's too long to be explained, but in short it is no different 
than loading normal executable file and instruct it to run from its 
entry point. During the loading, as usual, several VMAs are constructed 
on user space

> As I traced, the call_usermodehelper() use the work queues mechanism,
>  which would call kernel_tread() to new a kernel thread, then the new
> kernel thread call execve() loading the /sbin/hotplug.

yes, that's what I saw too. 

> The things puzzled me is that since the new kernel thread has no mm
> struct, how it become a user thread?

Actually, IMHO, that is still kernel thread. It is just "walk" to user 
space for a moment, run a program, exit and back to kernel space.

And...as Ohad said, it  must be called from process context, because:
- it is a blocking operation
- It must have an active "mm", while interrupt context doesn't have it

Everyone, CMIIW.

regards,

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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