]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kthread: introduce to_live_kthread()
authorOleg Nesterov <oleg@redhat.com>
Wed, 20 Mar 2013 04:06:50 +0000 (15:06 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 21 Mar 2013 05:27:12 +0000 (16:27 +1100)
commitf74197ee69363f044b7588d06f3b77edcfd7e730
tree947b349fb701a7d0618db7de7623a16a6ab2dfcd
parent883e7f2c3df6dc9c70a2b07154cb18664f79cb89
kthread: introduce to_live_kthread()

"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: Oleg 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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/kthread.c