aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/kthread.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2014-07-26 00:03:59 -0400
committerTejun Heo <tj@kernel.org>2014-07-28 14:07:52 -0400
commited1403ec2bd463050e481cd29be40c504021676c (patch)
treedb9574ae09b6a593d8a3e239f532abf1dcfa7c3a /kernel/kthread.c
parentddcb57e2ed0a4d0de5aef06735dd9df98894f818 (diff)
kthread_work: wake up worker only when the worker is idle
If the worker is already executing a work item when another is queued, we can safely skip wakeup without worrying about stalling queue thus avoiding waking up the busy worker spuriously. Spurious wakeups should be fine but still isn't nice and avoiding it is trivial here. tj: Updated description. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/kthread.c')
-rw-r--r--kernel/kthread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c
index c2390f41307b..ef483220e855 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -591,7 +591,7 @@ static void insert_kthread_work(struct kthread_worker *worker,
591 591
592 list_add_tail(&work->node, pos); 592 list_add_tail(&work->node, pos);
593 work->worker = worker; 593 work->worker = worker;
594 if (likely(worker->task)) 594 if (!worker->current_work && likely(worker->task))
595 wake_up_process(worker->task); 595 wake_up_process(worker->task);
596} 596}
597 597