public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch, minor]  workqueue: consistently use 'err' in __create_workqueue_key()
@ 2008-07-28 20:41 Dmitry Adamushko
  2008-07-29 11:02 ` Oleg Nesterov
  2008-07-29 16:22 ` [PATCH] workqueues: add comments to __create_workqueue_key() Oleg Nesterov
  0 siblings, 2 replies; 9+ messages in thread
From: Dmitry Adamushko @ 2008-07-28 20:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Oleg Nesterov



I guess error handling is a bit illogical in __create_workqueue_key().
Although, it won't cause any real problems.


---

From: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Subject: workqueue: consistently use 'err' in __create_workqueue_key()
    
Fix the logic behind the use of 'err' in the 'for_each_posible_cpu()' loop
of __create_workqueue_key().
    
Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ec7e4f6..738bf05 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -827,7 +827,8 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
 	if (singlethread) {
 		cwq = init_cpu_workqueue(wq, singlethread_cpu);
 		err = create_workqueue_thread(cwq, singlethread_cpu);
-		start_workqueue_thread(cwq, -1);
+		if (!err)
+			start_workqueue_thread(cwq, -1);
 	} else {
 		cpu_maps_update_begin();
 		spin_lock(&workqueue_lock);
@@ -836,9 +837,11 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
 
 		for_each_possible_cpu(cpu) {
 			cwq = init_cpu_workqueue(wq, cpu);
-			if (err || !cpu_online(cpu))
+			if (!cpu_online(cpu))
 				continue;
 			err = create_workqueue_thread(cwq, cpu);
+			if (err)
+				break;
 			start_workqueue_thread(cwq, cpu);
 		}
 		cpu_maps_update_done();




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

end of thread, other threads:[~2008-07-29 16:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-28 20:41 [patch, minor] workqueue: consistently use 'err' in __create_workqueue_key() Dmitry Adamushko
2008-07-29 11:02 ` Oleg Nesterov
2008-07-29 11:58   ` Dmitry Adamushko
2008-07-29 12:52     ` Oleg Nesterov
2008-07-29 13:44       ` Oleg Nesterov
2008-07-29 14:20         ` Dmitry Adamushko
2008-07-29 16:13           ` Oleg Nesterov
2008-07-29 16:52             ` Dmitry Adamushko
2008-07-29 16:22 ` [PATCH] workqueues: add comments to __create_workqueue_key() Oleg Nesterov

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