Dear Fawaad, Saumendar... > 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), I agree that initially, kernel thread might have its "mm" != NULL, but this is unlikely preferred because kernel thread run code with privilege 0 (kernel space code) thus it can safely (and must) drop the the user space part of its address space (dropping mm). So, in common sense, checking if mm == NULL is sufficient to determine whether it is a kernel thread or not > 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 ! Just want to add that each task struct (process descriptor) have "mm" and "active_mm" field. active_mm is the actual memory descriptor that is used to define process address space For normal process (not kernel thread), both are pointing to same memory structure (mm_struct), but on a kernel thread its mm is NULL. OTOH for every running process, they must have a set of page tables so the process is able to run in protected mode (maybe this is specific to Intel compatible architecture), so kernel thread is "forced" to pick a mm_struct. For simplicity, it is decided to pick previously running task's mm_struct. hope it helps regards Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/