After creating a new worker, create_worker() is calling kick_pool() to wake up the new worker task. However, as kick_pool() doesn't do anything if there is no work pending, it also calls wake_up_process() explicitly. There's no reason to call kick_pool() at all. wake_up_process() is enough by itself. Drop the unnecessary kick_pool() call.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -2217,12 +2217,11 @@ static struct worker *create_worker(struct worker_pool *pool) · 2216 unmodified lines | ||
| 2217 | 2217 | |
| 2218 | 2218 | worker->pool->nr_workers++; |
| 2219 | 2219 | worker_enter_idle(worker); |
| 2220 | − kick_pool(pool); | |
| 2221 | 2220 | |
| 2222 | 2221 | /* |
| 2223 | 2222 | * @worker is waiting on a completion in kthread() and will trigger hung |
| 2224 | − * check if not woken up soon. As kick_pool() might not have waken it | |
| 2225 | − * up, wake it up explicitly once more. | |
| 2223 | + * check if not woken up soon. As kick_pool() is noop if @pool is empty, | |
| 2224 | + * wake it up explicitly. | |
| 2226 | 2225 | */ |
| 2227 | 2226 | wake_up_process(worker->task); |
| 2228 | 2227 | |