aboutsummaryrefslogtreecommitdiff
path: root/kernel/kthread.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2014-07-26 12:03:59 +0800
committerMoyster <oysterized@gmail.com>2016-09-10 12:06:56 +0200
commitf9fa8fc6f8ff5fe10c4a83f361012dccc7de14f7 (patch)
treeb00405660712915fe8a8e566d68997b7a9f35138 /kernel/kthread.c
parent0a363ba133abd2036ce9b129eff1db32436ac250 (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> Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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 845059cb2..f8ef8bf4b 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -556,7 +556,7 @@ static void insert_kthread_work(struct kthread_worker *worker,
list_add_tail(&work->node, pos);
work->worker = worker;
- if (likely(worker->task))
+ if (!worker->current_work && likely(worker->task))
wake_up_process(worker->task);
}