From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>, Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/3] workqueue: remove the lock from wq_sysfs_prep_attrs()
Date: Wed, 20 May 2015 14:41:18 +0800 [thread overview]
Message-ID: <1432104079-2881-3-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1432104079-2881-1-git-send-email-laijs@cn.fujitsu.com>
Reading to wq->unbound_attrs requires protection of either wq_pool_mutex
or wq->mutex, and wq_sysfs_prep_attrs() is called with wq_pool_mutex held,
so we don't need to grab wq->mutex here.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
kernel/workqueue.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a04a9cd3..81b0e0d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4941,13 +4941,13 @@ static struct workqueue_attrs *wq_sysfs_prep_attrs(struct workqueue_struct *wq)
{
struct workqueue_attrs *attrs;
+ lockdep_assert_held(&wq_pool_mutex);
+
attrs = alloc_workqueue_attrs(GFP_KERNEL);
if (!attrs)
return NULL;
- mutex_lock(&wq->mutex);
copy_workqueue_attrs(attrs, wq->unbound_attrs);
- mutex_unlock(&wq->mutex);
return attrs;
}
--
2.1.0
next prev parent reply other threads:[~2015-05-20 6:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 6:41 [PATCH 0/3] workqueue: misc cleanup Lai Jiangshan
2015-05-20 6:41 ` [PATCH 1/3] workqueue: remove the declaration of copy_workqueue_attrs() Lai Jiangshan
2015-05-20 6:41 ` Lai Jiangshan [this message]
2015-05-20 6:41 ` [PATCH 3/3] workqueue: move flush_scheduled_work() to workqueue.h Lai Jiangshan
2015-05-21 21:27 ` [PATCH 0/3] workqueue: misc cleanup Tejun Heo
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=1432104079-2881-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;
as well as URLs for NNTP newsgroup(s).