From f9fa8fc6f8ff5fe10c4a83f361012dccc7de14f7 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Sat, 26 Jul 2014 12:03:59 +0800 Subject: 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 Signed-off-by: Tejun Heo Signed-off-by: franciscofranco --- kernel/kthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel') 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); } -- cgit v1.2.3