Hi, Mulyadi Santosa wrote:
So why it is separated? IMHO the reason is to identify which process is kernel thread (doesn't own a process address space) and which one is normal process (owns a process address space). As you can see on functions related with context switching, by checking task_struct->mm, the scheduler can decide whether it is going to switch onto kernel thread or not. if
There's one other reason for having both task->mm and task->active_mm: in some cases, you might be executing a process without being in the address space of that process. This is possible because during the execution of a syscall, you're in kernel mode, so you don't necessarily need to be in the correct address space. This avoids some costly TLB switches.
For more information, read section 4.3 of Mel Gorman's book at http://www.phptr.com/content/images/0131453483/downloads/gorman_book.pdf. Sincerly, Thomas -- Thomas Petazzoni thomas.petazzoni@xxxxxxxx -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/