Commit b3212fe2 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Peter Zijlstra

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200321113242.228481202@linutronix.de
parent e5d4d175
...@@ -2492,3 +2492,6 @@ static inline bool is_per_cpu_kthread(struct task_struct *p) ...@@ -2492,3 +2492,6 @@ static inline bool is_per_cpu_kthread(struct task_struct *p)
return true; return true;
} }
#endif #endif
void swake_up_all_locked(struct swait_queue_head *q);
void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait);
...@@ -32,6 +32,19 @@ void swake_up_locked(struct swait_queue_head *q) ...@@ -32,6 +32,19 @@ void swake_up_locked(struct swait_queue_head *q)
} }
EXPORT_SYMBOL(swake_up_locked); 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) void swake_up_one(struct swait_queue_head *q)
{ {
unsigned long flags; unsigned long flags;
...@@ -69,7 +82,7 @@ void swake_up_all(struct swait_queue_head *q) ...@@ -69,7 +82,7 @@ void swake_up_all(struct swait_queue_head *q)
} }
EXPORT_SYMBOL(swake_up_all); 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; wait->task = current;
if (list_empty(&wait->task_list)) if (list_empty(&wait->task_list))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment