aboutsummaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-06 18:04:53 -0800
committerTejun Heo <tj@kernel.org>2013-02-06 18:04:53 -0800
commit1606283622689bdc460052b4a1281c36de13fe49 (patch)
tree7e23128500a97cd006a9580e96583e681e0084a1 /kernel/workqueue.c
parent0b3dae68ac199fac224fea9a31907b44f0d257b3 (diff)
workqueue: cosmetic update in try_to_grab_pending()
With the recent is-work-queued-here test simplification, the nested if() in try_to_grab_pending() can be collapsed. Collapse it. This patch is purely cosmetic. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 251f0091429..e2dd61861fb 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1107,31 +1107,27 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
* item is currently queued on that pool.
*/
cwq = get_work_cwq(work);
- if (cwq) {
- if (cwq->pool == pool) {
- debug_work_deactivate(work);
+ if (cwq && cwq->pool == pool) {
+ debug_work_deactivate(work);
- /*
- * A delayed work item cannot be grabbed directly
- * because it might have linked NO_COLOR work items
- * which, if left on the delayed_list, will confuse
- * cwq->nr_active management later on and cause
- * stall. Make sure the work item is activated
- * before grabbing.
- */
- if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
- cwq_activate_delayed_work(work);
+ /*
+ * A delayed work item cannot be grabbed directly because
+ * it might have linked NO_COLOR work items which, if left
+ * on the delayed_list, will confuse cwq->nr_active
+ * management later on and cause stall. Make sure the work
+ * item is activated before grabbing.
+ */
+ if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
+ cwq_activate_delayed_work(work);
- list_del_init(&work->entry);
- cwq_dec_nr_in_flight(get_work_cwq(work),
- get_work_color(work));
+ list_del_init(&work->entry);
+ cwq_dec_nr_in_flight(get_work_cwq(work), get_work_color(work));
- /* work->data points to cwq iff queued, point to pool */
- set_work_pool_and_keep_pending(work, pool->id);
+ /* work->data points to cwq iff queued, point to pool */
+ set_work_pool_and_keep_pending(work, pool->id);
- spin_unlock(&pool->lock);
- return 1;
- }
+ spin_unlock(&pool->lock);
+ return 1;
}
spin_unlock(&pool->lock);
fail: