mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kthread_work: wake up worker only when the worker is idle
@ 2014-07-26  4:03 Lai Jiangshan
  2014-07-28 18:11 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Lai Jiangshan @ 2014-07-26  4:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tejun Heo, Lai Jiangshan, Andrew Morton, David Rientjes,
	Tetsuo Handa, Nishanth Aravamudan

If the worker task is not idle, it may sleep on some conditions by the request
of the work.  Our unfriendly wakeup in the insert_kthread_work() may confuse
the worker.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 kernel/kthread.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index c2390f4..ef48322 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -591,7 +591,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);
 }
 
-- 
1.7.4.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kthread_work: wake up worker only when the worker is idle
  2014-07-26  4:03 [PATCH] kthread_work: wake up worker only when the worker is idle Lai Jiangshan
@ 2014-07-28 18:11 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2014-07-28 18:11 UTC (permalink / raw)
  To: Lai Jiangshan
  Cc: linux-kernel, Andrew Morton, David Rientjes, Tetsuo Handa,
	Nishanth Aravamudan

On Sat, Jul 26, 2014 at 12:03:59PM +0800, Lai Jiangshan wrote:
> If the worker task is not idle, it may sleep on some conditions by the request
> of the work.  Our unfriendly wakeup in the insert_kthread_work() may confuse
> the worker.
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>

Applied to wq/for-3.17.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-28 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-26  4:03 [PATCH] kthread_work: wake up worker only when the worker is idle Lai Jiangshan
2014-07-28 18:11 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®