• Oleg Nesterov's avatar
    introduce PF_KTHREAD flag · 7b34e428
    Oleg Nesterov authored
    Introduce the new PF_KTHREAD flag to mark the kernel threads.  It is set
    by INIT_TASK() and copied to the forked childs (we could set it in
    kthreadd() along with PF_NOFREEZE instead).
    
    daemonize() was changed as well.  In that case testing of PF_KTHREAD is
    racy, but daemonize() is hopeless anyway.
    
    This flag is cleared in do_execve(), before search_binary_handler().
    Probably not the best place, we can do this in exec_mmap() or in
    start_thread(), or clear it along with PF_FORKNOEXEC.  But I think this
    doesn't matter in practice, and if do_execve() fails kthread should die
    soon.
    Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
    Cc: Roland McGrath <roland@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7b34e428
exit.c 45.7 KB