summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-06 21:04:53 -0500
committerTejun Heo <tj@kernel.org>2013-02-06 21:04:53 -0500
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 251f00914295..e2dd61861fbd 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,
1107 * item is currently queued on that pool. 1107 * item is currently queued on that pool.
1108 */ 1108 */
1109 cwq = get_work_cwq(work); 1109 cwq = get_work_cwq(work);
1110 if (cwq) { 1110 if (cwq && cwq->pool == pool) {
1111 if (cwq->pool == pool) { 1111 debug_work_deactivate(work);
1112 debug_work_deactivate(work);
1113 1112
1114 /* 1113 /*
1115 * A delayed work item cannot be grabbed directly 1114 * A delayed work item cannot be grabbed directly because
1116 * because it might have linked NO_COLOR work items 1115 * it might have linked NO_COLOR work items which, if left
1117 * which, if left on the delayed_list, will confuse 1116 * on the delayed_list, will confuse cwq->nr_active
1118 * cwq->nr_active management later on and cause 1117 * management later on and cause stall. Make sure the work
1119 * stall. Make sure the work item is activated 1118 * item is activated before grabbing.
1120 * before grabbing. 1119 */
1121 */ 1120 if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
1122 if (*work_data_bits(work) & WORK_STRUCT_DELAYED) 1121 cwq_activate_delayed_work(work);
1123 cwq_activate_delayed_work(work);
1124 1122
1125 list_del_init(&work->entry); 1123 list_del_init(&work->entry);
1126 cwq_dec_nr_in_flight(get_work_cwq(work), 1124 cwq_dec_nr_in_flight(get_work_cwq(work), get_work_color(work));
1127 get_work_color(work));
1128 1125
1129 /* work->data points to cwq iff queued, point to pool */ 1126 /* work->data points to cwq iff queued, point to pool */
1130 set_work_pool_and_keep_pending(work, pool->id); 1127 set_work_pool_and_keep_pending(work, pool->id);
1131 1128
1132 spin_unlock(&pool->lock); 1129 spin_unlock(&pool->lock);
1133 return 1; 1130 return 1;
1134 }
1135 } 1131 }
1136 spin_unlock(&pool->lock); 1132 spin_unlock(&pool->lock);
1137fail: 1133fail: