From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>, Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [PATCH 2/3] workqueue: extend wq_pool_mutex to also protect pwq-installation
Date: Wed, 8 Oct 2014 11:53:32 +0800 [thread overview]
Message-ID: <1412740423-20782-3-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1412740423-20782-1-git-send-email-laijs@cn.fujitsu.com>
Athough pwq-installation without wq_pool_mutex held is not bug,
but it is not good design, it is better to make the pwq-allocation and installation
are in the (same) wq_pool_mutex.
And since the pwq-allocation and installation are in the same wq_pool_mutex,
get_online_cpus() will not be needed for this reason, and it will be remove
in later patch.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
kernel/workqueue.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7a217f0..9bc3a87 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3805,8 +3805,6 @@ int apply_workqueue_attrs(struct workqueue_struct *wq,
}
}
- mutex_unlock(&wq_pool_mutex);
-
/* all pwqs have been created successfully, let's install'em */
mutex_lock(&wq->mutex);
@@ -3827,6 +3825,8 @@ int apply_workqueue_attrs(struct workqueue_struct *wq,
put_pwq_unlocked(pwq_tbl[node]);
put_pwq_unlocked(dfl_pwq);
+ mutex_unlock(&wq_pool_mutex);
+
put_online_cpus();
ret = 0;
/* fall through */
--
1.7.4.4
next prev parent reply other threads:[~2014-10-08 3:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 3:53 [PATCH 0/3] workqueue: unbound workqueue management Vs hotplug Lai Jiangshan
2014-10-08 3:53 ` [PATCH 1/3] workqueue: add wq_unbound_online_cpumask Lai Jiangshan
2014-10-27 13:15 ` Tejun Heo
2014-10-08 3:53 ` Lai Jiangshan [this message]
2014-10-27 13:20 ` [PATCH 2/3] workqueue: extend wq_pool_mutex to also protect pwq-installation Tejun Heo
2014-10-08 3:53 ` [PATCH 3/3] workqueue: remove get_online_cpus() from apply_workqueue_attrs() Lai Jiangshan
2014-10-27 13:41 ` Tejun Heo
2014-10-27 9:27 ` [PATCH 0/3] workqueue: unbound workqueue management Vs hotplug Lai Jiangshan
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=1412740423-20782-3-git-send-email-laijs@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/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 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®