lkml.org 
[lkml]   [2012]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/10] workqueue: remove unneeded check
Date
Since we always pass flush responsibility to next, we will not deprive it,
now the ->first_flusher can only be changed by the first_flusher, no one
can change it, no race as 4ce48b37 said.

Remove the check introduced by 4ce48b37, use BUG_ON() instead.

Also move "wq->first_flusher = NULL;" later.

This patch doesn't make any functional difference.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
kernel/workqueue.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 360b7e2..acd9e2f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2682,12 +2682,7 @@ void flush_workqueue(struct workqueue_struct *wq)

mutex_lock(&wq->flush_mutex);

- /* we might have raced, check again with mutex held */
- if (wq->first_flusher != &this_flusher)
- goto out_unlock;
-
- wq->first_flusher = NULL;
-
+ BUG_ON(wq->first_flusher != &this_flusher);
BUG_ON(!list_empty(&this_flusher.list));
BUG_ON(wq->flush_color != this_flusher.flush_color);

@@ -2728,6 +2723,7 @@ void flush_workqueue(struct workqueue_struct *wq)

if (list_empty(&wq->flusher_queue)) {
BUG_ON(wq->flush_color != wq->work_color);
+ wq->first_flusher = NULL;
break;
}

--
1.7.4.4


\
 
 \ /
  Last update: 2012-09-24 13:01    [W:0.241 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site