History

workqueues: lockdep annotations for flush_work()

Add lockdep annotations to flush_work() and update the comment.

Oleg Nesterov committed 18 years ago

Commit a67da701 parent 69b895f1 file · +5 −0Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+5−0
@@ -427,6 +427,8 @@ EXPORT_SYMBOL_GPL(flush_workqueue); · 426 unmodified lines
427427 * flush_work - block until a work_struct's callback has terminated
428428 * @work: the work which is to be flushed
429429 *
430+ * Returns false if @work has already terminated.
431+ *
430432 * It is expected that, prior to calling flush_work(), the caller has
431433 * arranged for the work to not be requeued, otherwise it doesn't make
432434 * sense to use this function.
@@ -442,6 +444,9 @@ int flush_work(struct work_struct *work) · 9 unmodified lines
442444 if (!cwq)
443445 return 0;
444446
447+ lock_acquire(&cwq->wq->lockdep_map, 0, 0, 0, 2, _THIS_IP_);
448+ lock_release(&cwq->wq->lockdep_map, 1, _THIS_IP_);
449+
445450 prev = NULL;
446451 spin_lock_irq(&cwq->lock);
447452 if (!list_empty(&work->entry)) {