All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Adamushko <dmitry.adamushko@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Oleg Nesterov <oleg@tv-sign.ru>
Subject: [patch, minor]  workqueue: consistently use 'err' in __create_workqueue_key()
Date: Mon, 28 Jul 2008 22:41:34 +0200	[thread overview]
Message-ID: <1217277694.20627.9.camel@earth> (raw)



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();




             reply	other threads:[~2008-07-28 20:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28 20:41 Dmitry Adamushko [this message]
2008-07-29 11:02 ` [patch, minor] workqueue: consistently use 'err' in __create_workqueue_key() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217277694.20627.9.camel@earth \
    --to=dmitry.adamushko@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.