memory descriptor and kernel threads

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

 



Hi All,
I have queries related to mm_struct and kernel thread.
 
As per my understanding mm_struct represent the process's address space (i.e. 0-3GB area).
 
Some of the points mentioned in the Linux kernel Development (by Robert Love) book about mm_struct and kernel thread are :
 
"Kernel threads do not have a process address space and therefore do not have an associated memory descriptor. Thus, the mm field of a kernel thread's process descriptor is NULL. "
 
"Because kernel threads do not have any pages in user-space, they do not really deserve their own memory descriptor and page tables (page tables are discussed later in the chapter). Despite this, kernel threads need some of the data, such as the page tables, even to access kernel memory."
 
"Kernel threads do not have an address space and mm is NULL. Therefore, when a kernel thread is scheduled, the kernel notices that mm is NULL and keeps the previous process's address space loaded. The kernel then updates the active_mm field of the kernel thread's process descriptor to refer to the previous process's memory descriptor. The kernel thread can then use the previous process's page tables as needed."
 
Now my queries are:
1. First it is mentioned that the kernel threads dont have any page in user space and hence they dont deserve memory desriptor and page tables and in the next line it says it needs some data such as page tables to access kernel memory. What page table it is referring here?? Every process has its own page table for mapping the virtual to physical address, why kernel thread requires that?
 
2. does kernel thread run in a process context? I mean it says when a kernel thread is scheduled, it keeps the previous process's address space loaded.
 
3. Further it is mentioned in the same book as "Because kernel threads do not access user-space memory, they make use of only the information in the address space pertaining to kernel memory, which is the same for all processes.". That means the process's mm_struct or the page table contains the information about kernel memory?
 
Please someone could clarify my doubts.
 
Thanks and regards,
Adil Mujeeb

[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