reimplement flush_workqueue()
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 9 May 2007 09:33:51 +0000 (02:33 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 9 May 2007 19:30:50 +0000 (12:30 -0700)
commitfc2e4d70410546307344821eed6fd23803a45286
treeb8253b7e42245c9b21b959a77c8070ddcbc9359e
parente18f3ffb9c3ddfc1b4ad8f38f5f2acae8c16f0c9
reimplement flush_workqueue()

Remove ->remove_sequence, ->insert_sequence, and ->work_done from struct
cpu_workqueue_struct.  To implement flush_workqueue() we can queue a
barrier work on each CPU and wait for its completition.

The barrier is queued under workqueue_mutex to ensure that per cpu
wq->cpu_wq is alive, we drop this mutex before going to sleep.  If CPU goes
down while we are waiting for completition, take_over_work() will move the
barrier on another CPU, and the handler will wake up us eventually.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/workqueue.c