Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH] workqueues: lockdep annotations for flush_work()

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


oleg at tv-sign

Jul 6, 2008, 9:28 AM

Post #1 of 2 (50 views)
Permalink
[PATCH] workqueues: lockdep annotations for flush_work()

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

Signed-off-by: Oleg Nesterov <oleg[at]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)) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


jarkao2 at gmail

Jul 6, 2008, 10:35 AM

Post #2 of 2 (46 views)
Permalink
Re: [PATCH] workqueues: lockdep annotations for flush_work() [In reply to]

On Sun, Jul 06, 2008 at 08:28:00PM +0400, Oleg Nesterov wrote:
> Add lockdep annotations to flush_work() and update the comment.
>
> Signed-off-by: Oleg Nesterov <oleg[at]tv-sign.ru>

Looks OK to me. (But probably the comment on "true" would be easier
(more precise).)

Regards,
Jarek P.

>
> --- 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)) {
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.