Commit 16062836 authored by Tejun Heo's avatar Tejun Heo

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: default avatarTejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
parent 0b3dae68
...@@ -1107,24 +1107,21 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, ...@@ -1107,24 +1107,21 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
* item is currently queued on that pool. * item is currently queued on that pool.
*/ */
cwq = get_work_cwq(work); cwq = get_work_cwq(work);
if (cwq) { if (cwq && cwq->pool == pool) {
if (cwq->pool == pool) {
debug_work_deactivate(work); debug_work_deactivate(work);
/* /*
* A delayed work item cannot be grabbed directly * A delayed work item cannot be grabbed directly because
* because it might have linked NO_COLOR work items * it might have linked NO_COLOR work items which, if left
* which, if left on the delayed_list, will confuse * on the delayed_list, will confuse cwq->nr_active
* cwq->nr_active management later on and cause * management later on and cause stall. Make sure the work
* stall. Make sure the work item is activated * item is activated before grabbing.
* before grabbing.
*/ */
if (*work_data_bits(work) & WORK_STRUCT_DELAYED) if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
cwq_activate_delayed_work(work); cwq_activate_delayed_work(work);
list_del_init(&work->entry); list_del_init(&work->entry);
cwq_dec_nr_in_flight(get_work_cwq(work), cwq_dec_nr_in_flight(get_work_cwq(work), get_work_color(work));
get_work_color(work));
/* work->data points to cwq iff queued, point to pool */ /* work->data points to cwq iff queued, point to pool */
set_work_pool_and_keep_pending(work, pool->id); set_work_pool_and_keep_pending(work, pool->id);
...@@ -1132,7 +1129,6 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, ...@@ -1132,7 +1129,6 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
spin_unlock(&pool->lock); spin_unlock(&pool->lock);
return 1; return 1;
} }
}
spin_unlock(&pool->lock); spin_unlock(&pool->lock);
fail: fail:
local_irq_restore(*flags); local_irq_restore(*flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment