mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 4/6] sched/swait: Add swait_event_lock_irq()
Date: Thu, 13 Jun 2019 16:50:25 +0200	[thread overview]
Message-ID: <20190613145027.27753-5-bigeasy@linutronix.de> (raw)
In-Reply-To: <20190613145027.27753-1-bigeasy@linutronix.de>

The swait_event_lock_irq() is inspired by wait_event_lock_irq(). This is
required by the workqueue code once it switches to swait.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/linux/swait.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/swait.h b/include/linux/swait.h
index 73e06e9986d4b..12612823c2cb1 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -297,4 +297,18 @@ do {									\
 	__ret;								\
 })
 
+#define __swait_event_lock_irq(wq, condition, lock, cmd)		\
+	___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0,		\
+		       raw_spin_unlock_irq(&lock);			\
+		       cmd;						\
+		       schedule();					\
+		       raw_spin_lock_irq(&lock))
+
+#define swait_event_lock_irq(wq_head, condition, lock)			\
+	do {								\
+		if (condition)						\
+			break;						\
+		__swait_event_lock_irq(wq_head, condition, lock, );	\
+	} while (0)
+
 #endif /* _LINUX_SWAIT_H */
-- 
2.20.1


  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 ` Sebastian Andrzej Siewior [this message]
2019-06-13 14:50 ` [PATCH 5/6] workqueue: Use swait for wq_manager_wait Sebastian Andrzej Siewior
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-5-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®