]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kthread: introduce to_live_kthread()
authorOleg Nesterov <oleg@redhat.com>
Tue, 26 Mar 2013 23:24:03 +0000 (10:24 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Apr 2013 05:53:02 +0000 (16:53 +1100)
commit9884aa872104fbeac6a2d7436bedb16ad45ee27c
tree9bd66e4ceaf13a6d761db11330798cbd5133ce0d
parentce2b6e199380250e8f7785dfd7e0206150dc9c06
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