From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 5/6] workqueue: Use swait for wq_manager_wait
Date: Thu, 13 Jun 2019 16:50:26 +0200 [thread overview]
Message-ID: <20190613145027.27753-6-bigeasy@linutronix.de> (raw)
In-Reply-To: <20190613145027.27753-1-bigeasy@linutronix.de>
In order for the workqueue code use raw_spinlock_t typed locking there
must not be a spinlock_t typed lock be acquired. A wait_queue_head uses
a spinlock_t lock for its list protection.
Use a swait based queue head to avoid raw_spinlock_t -> spinlock_t
locking.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/workqueue.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a3c2959e5c4f0..f27a57fce5079 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -50,6 +50,7 @@
#include <linux/uaccess.h>
#include <linux/sched/isolation.h>
#include <linux/nmi.h>
+#include <linux/swait.h>
#include "workqueue_internal.h"
@@ -301,7 +302,7 @@ static struct workqueue_attrs *wq_update_unbound_numa_attrs_buf;
static DEFINE_MUTEX(wq_pool_mutex); /* protects pools and workqueues list */
static DEFINE_MUTEX(wq_pool_attach_mutex); /* protects worker attach/detach */
static DEFINE_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */
-static DECLARE_WAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */
+static DECLARE_SWAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */
static LIST_HEAD(workqueues); /* PR: list of all workqueues */
static bool workqueue_freezing; /* PL: have wqs started freezing? */
@@ -2143,7 +2144,7 @@ static bool manage_workers(struct worker *worker)
pool->manager = NULL;
pool->flags &= ~POOL_MANAGER_ACTIVE;
- wake_up(&wq_manager_wait);
+ swake_up_one(&wq_manager_wait);
return true;
}
@@ -3538,7 +3539,7 @@ static void put_unbound_pool(struct worker_pool *pool)
* manager and @pool gets freed with the flag set.
*/
spin_lock_irq(&pool->lock);
- wait_event_lock_irq(wq_manager_wait,
+ swait_event_lock_irq(wq_manager_wait,
!(pool->flags & POOL_MANAGER_ACTIVE), pool->lock);
pool->flags |= POOL_MANAGER_ACTIVE;
--
2.20.1
next prev parent reply other threads:[~2019-06-13 14:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 14:50 [PATCH 0/6] workqueue: convert to raw_spinlock_t Sebastian Andrzej Siewior
2019-06-13 14:50 ` [PATCH 1/6] workqueue: Make alloc/apply/free_workqueue_attrs() static Sebastian Andrzej Siewior
2019-06-13 14:50 ` [PATCH 2/6] workqueue: Remove GPF argument from alloc_workqueue_attrs() Sebastian Andrzej Siewior
2019-06-13 14:50 ` [PATCH 3/6] workqueue: Don't assume that the callback has interrupts disabled Sebastian Andrzej Siewior
2019-06-13 14:50 ` [PATCH 4/6] sched/swait: Add swait_event_lock_irq() Sebastian Andrzej Siewior
2019-06-13 14:50 ` Sebastian Andrzej Siewior [this message]
2019-06-13 14:50 ` [PATCH 6/6] workqueue: Convert the locks to raw type Sebastian Andrzej Siewior
2019-06-26 7:17 ` [PATCH 0/6] workqueue: convert to raw_spinlock_t Sebastian Andrzej Siewior
2019-06-26 13:49 ` Tejun Heo
2019-06-26 13:53 ` Thomas Gleixner
2019-06-26 14:01 ` Tejun Heo
2019-06-26 14:12 ` Thomas Gleixner
2019-06-26 14:18 ` Tejun Heo
2019-06-26 14:09 ` Sebastian Andrzej Siewior
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=20190613145027.27753-6-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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®