mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] workqueues: lockdep annotations for flush_work()
@ 2008-07-06 16:28 Oleg Nesterov
  2008-07-06 17:35 ` Jarek Poplawski
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2008-07-06 16:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jarek Poplawski, Johannes Berg, linux-kernel

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

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 26-rc2/kernel/workqueue.c~FW_LOCKDEP	2008-06-29 19:36:27.000000000 +0400
+++ 26-rc2/kernel/workqueue.c	2008-07-06 20:15:16.000000000 +0400
@@ -403,6 +403,8 @@ EXPORT_SYMBOL_GPL(flush_workqueue);
  * flush_work - block until a work_struct's callback has terminated
  * @work: the work which is to be flushed
  *
+ * Returns false if @work has already terminated.
+ *
  * It is expected that, prior to calling flush_work(), the caller has
  * arranged for the work to not be requeued, otherwise it doesn't make
  * sense to use this function.
@@ -418,6 +420,9 @@ int flush_work(struct work_struct *work)
 	if (!cwq)
 		return 0;
 
+	lock_acquire(&cwq->wq->lockdep_map, 0, 0, 0, 2, _THIS_IP_);
+	lock_release(&cwq->wq->lockdep_map, 1, _THIS_IP_);
+
 	prev = NULL;
 	spin_lock_irq(&cwq->lock);
 	if (!list_empty(&work->entry)) {


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-06 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-06 16:28 [PATCH] workqueues: lockdep annotations for flush_work() Oleg Nesterov
2008-07-06 17:35 ` Jarek Poplawski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome