summaryrefslogtreecommitdiff
path: root/kernel/sched/swait.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-03-21 12:25:59 +0100
committerPeter Zijlstra <peterz@infradead.org>2020-03-21 16:00:23 +0100
commitb3212fe2bc06fa1014b3063b85b2bac4332a1c28 (patch)
tree5c27a5307ee1bd6784fde4be7fa11c05f29a32b4 /kernel/sched/swait.c
parente5d4d1756b07d9490a0269a9e68c1e05ee1feb9b (diff)
sched/swait: Prepare usage in completions
As a preparation to use simple wait queues for completions: - Provide swake_up_all_locked() to support complete_all() - Make __prepare_to_swait() public available This is done to enable the usage of complete() within truly atomic contexts on a PREEMPT_RT enabled kernel. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20200321113242.228481202@linutronix.de
Diffstat (limited to 'kernel/sched/swait.c')
-rw-r--r--kernel/sched/swait.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
index e83a3f8449f6..e1c655f928c7 100644
--- a/kernel/sched/swait.c
+++ b/kernel/sched/swait.c
@@ -32,6 +32,19 @@ void swake_up_locked(struct swait_queue_head *q)
}
EXPORT_SYMBOL(swake_up_locked);
+/*
+ * Wake up all waiters. This is an interface which is solely exposed for
+ * completions and not for general usage.
+ *
+ * It is intentionally different from swake_up_all() to allow usage from
+ * hard interrupt context and interrupt disabled regions.
+ */
+void swake_up_all_locked(struct swait_queue_head *q)
+{
+ while (!list_empty(&q->task_list))
+ swake_up_locked(q);
+}
+
void swake_up_one(struct swait_queue_head *q)
{
unsigned long flags;
@@ -69,7 +82,7 @@ void swake_up_all(struct swait_queue_head *q)
}
EXPORT_SYMBOL(swake_up_all);
-static void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait)
+void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait)
{
wait->task = current;
if (list_empty(&wait->task_list))