workqueue: reuse the already calculated pwq in try_to_grab_pending()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 10 Jul 2014 16:11:13 +0000 (00:11 +0800)
committerTejun Heo <tj@kernel.org>
Fri, 11 Jul 2014 15:14:50 +0000 (11:14 -0400)
try_to_grab_pending() was re-calculating the associated pwq using
get_work_pwq() when it already has it cached in a local varible and
the association can't change.  Reuse the local variable instead.

This doesn't introduce any functional changes.

tj: Updated description.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index f344334f5690a610a69c55504be05addeff1a4a3..338d418ba6aa6fc3a89787ed1d9a92a6eeae9b75 100644 (file)
@@ -1225,7 +1225,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
                        pwq_activate_delayed_work(work);
 
                list_del_init(&work->entry);
-               pwq_dec_nr_in_flight(get_work_pwq(work), get_work_color(work));
+               pwq_dec_nr_in_flight(pwq, get_work_color(work));
 
                /* work->data points to pwq iff queued, point to pool */
                set_work_pool_and_keep_pending(work, pool->id);