diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2007-07-17 04:03:55 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 10:23:03 -0700 |
commit | 13c22168b7276dffe49dc66675d5a78f6d288e0d (patch) | |
tree | 4062929954f04db9c24be08cba94a0ed6e7fd65f /drivers/parisc/power.c | |
parent | 87a7defb0d4255d5aea2c5067813b26836127983 (diff) | |
download | linux-13c22168b7276dffe49dc66675d5a78f6d288e0d.tar.bz2 |
destroy_workqueue() can livelock
Pointed out by Michal Schmidt <mschmidt@redhat.com>.
The bug was introduced in 2.6.22 by me.
cleanup_workqueue_thread() does flush_cpu_workqueue(cwq) in a loop until
->worklist becomes empty. This is live-lockable, a re-niced caller can get
CPU after wake_up() and insert a new barrier before the lower-priority
cwq->thread has a chance to clear ->current_work.
Change cleanup_workqueue_thread() to do flush_cpu_workqueue(cwq) only once.
We can rely on the fact that run_workqueue() won't return until it flushes
all works. So it is safe to call kthread_stop() after that, the "should
stop" request won't be noticed until run_workqueue() returns.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Michal Schmidt <mschmidt@redhat.com>
Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/parisc/power.c')
0 files changed, 0 insertions, 0 deletions