]> git.baikalelectronics.ru Git - kernel.git/commit
kthread: Allow kthread_park() on a parked kthread
authorPeter Zijlstra <peterz@infradead.org>
Fri, 4 May 2018 09:11:42 +0000 (11:11 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 25 May 2018 06:03:51 +0000 (08:03 +0200)
commit7331ec18ea1a022a1c29f252e407b51a6481e870
treeee2ffdde3e7ca65a6090babe51ae1851411e0903
parent7f6f623f4b30f30f5f43331f3ebbc873f56c6ed7
kthread: Allow kthread_park() on a parked kthread

The following commit:

  6085921f7634 ("kthread, sched/wait: Fix kthread_parkme() completion issue")

added a WARN() in the case where we call kthread_park() on an already
parked thread, because the old code wasn't doing the right thing there
and it wasn't at all clear that would happen.

It turns out, this does in fact happen, so we have to deal with it.

Instead of potentially returning early, also wait for the completion.
This does however mean we have to use complete_all() and re-initialize
the completion on re-use.

Reported-by: LKP <lkp@01.org>
Tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kernel test robot <lkp@intel.com>
Cc: wfg@linux.intel.com
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 6085921f7634 ("kthread, sched/wait: Fix kthread_parkme() completion issue")
Link: http://lkml.kernel.org/r/20180504091142.GI12235@hirez.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/kthread.c