Re: kernel thread

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

 




----- Original Message ----- From: "Fawad Lateef" <fawadlateef@xxxxxxxxx>
To: "Saumender Dash" <sdash@xxxxxxxxxxxxxxxxxxx>
Cc: "pradeep singh" <2500.pradeep@xxxxxxxxx>; <kernelnewbies@xxxxxxxxxxxx>
Sent: Wednesday, December 14, 2005 11:43 AM
Subject: Re: kernel thread


On 12/14/05, Saumender Dash <sdash@xxxxxxxxxxxxxxxxxxx> wrote:

>Yes, but keep in mind you can't say that mm of the kernel thread is
>always NULL as if the kernel thread won't call daemonize then the mm
>will be there (some one CMIIW) .

A kernel thread does not have a process address space,
it runs in the address space of the process which was running just before
the kernel thread was started. That's whay in the task structure the mm
field is NULL. This mm field defines the process address space of a process.


The kernel thread can have mm != NULL (means process address space),
where mm is actually of the process from which kernel thread is
created (calling explicit daeminize will make sure the mm will be
dropped), for example just try to create a kernel thread from
init_module function and only do print mm of the current (thread
created from init_module) and you will see it won't be null but if you
call daeminize then you can see mm will become  null !

And while scheduling context_switch function first checks for mm and
if it exists then it will use that and if not then previous process mm
is assigned to it. As kernel threads are likely to call daemonize or
created from other thread which already did daemonized so greater
chances of kernel thread -> mm will be null !


Great. Thanks for the info. I was not aware of this stuff.

Saumendra Dash

--
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