aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2014-07-22 01:01:59 -0400
committerTejun Heo <tj@kernel.org>2014-07-22 10:37:52 -0400
commita489a03eca74cd1d5ac771f4b2ae2c826aab0b30 (patch)
tree7ac69e996945da543012d86bc2efe66cb5c082a2 /kernel/workqueue.c
parentd8ca83e68c8c7efd8e5920a046d5c576b08609f0 (diff)
workqueue: remove an unneeded UNBOUND test before waking up the next worker
In process_one_work(): if ((worker->flags & WORKER_UNBOUND) && need_more_worker(pool)) wake_up_worker(pool); the first test is unneeded. Even if the first test is removed, it doesn't affect the wake-up logic for WORKER_UNBOUND, and it will not introduce any useless wake-ups for normal per-cpu workers since nr_running is always >= 1. It will introduce useless/redundant wake-ups for CPU_INTENSIVE, but this case is rare and the next patch will also remove this redundant wake-up. tj: Minor updates to the description and comment. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index d3444169e261..c20cfbe89194 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2048,10 +2048,13 @@ __acquires(&pool->lock)
2048 worker_set_flags(worker, WORKER_CPU_INTENSIVE, true); 2048 worker_set_flags(worker, WORKER_CPU_INTENSIVE, true);
2049 2049
2050 /* 2050 /*
2051 * Unbound pool isn't concurrency managed and work items should be 2051 * Wake up another worker if necessary. The condition is always
2052 * executed ASAP. Wake up another worker if necessary. 2052 * false for normal per-cpu workers since nr_running would always
2053 * be >= 1 at this point. This is used to chain execution of the
2054 * pending work items for WORKER_NOT_RUNNING workers such as the
2055 * UNBOUND ones.
2053 */ 2056 */
2054 if ((worker->flags & WORKER_UNBOUND) && need_more_worker(pool)) 2057 if (need_more_worker(pool))
2055 wake_up_worker(pool); 2058 wake_up_worker(pool);
2056 2059
2057 /* 2060 /*