• Oleg Nesterov's avatar
    kthread: introduce to_live_kthread() · 4ecdafc8
    Oleg Nesterov authored
    "k->vfork_done != NULL" with a barrier() after to_kthread(k) in
    task_get_live_kthread(k) looks unclear, and sub-optimal because we load
    ->vfork_done twice.
    
    All we need is to ensure that we do not return to_kthread(NULL).  Add a
    new trivial helper which loads/checks ->vfork_done once, this also looks
    more understandable.
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
    Cc: Tejun Heo <tj@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    4ecdafc8
kthread.c 17.2 KB