From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jarek Poplawski <jarkao2@o2.pl>,
Johannes Berg <johannes@sipsolutions.net>,
linux-kernel@vger.kernel.org
Subject: [PATCH] workqueues: lockdep annotations for flush_work()
Date: Sun, 6 Jul 2008 20:28:00 +0400 [thread overview]
Message-ID: <20080706162800.GA6443@tv-sign.ru> (raw)
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)) {
next reply other threads:[~2008-07-06 16:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-06 16:28 Oleg Nesterov [this message]
2008-07-06 17:35 ` Jarek Poplawski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080706162800.GA6443@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=jarkao2@o2.pl \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®