[patch V3 15/20] sched/swait: Prepare usage in completions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: LKML <linux-kernel@xxxxxxxxxxxxxxx>
- Subject: [patch V3 15/20] sched/swait: Prepare usage in completions
- From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
- Date: Sat, 21 Mar 2020 12:25:59 +0100
- Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Sebastian Siewior <bigeasy@xxxxxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Joel Fernandes <joel@xxxxxxxxxxxxxxxxx>, Oleg Nesterov <oleg@xxxxxxxxxx>, Davidlohr Bueso <dave@xxxxxxxxxxxx>, Logan Gunthorpe <logang@xxxxxxxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Kurt Schwemmer <kurt.schwemmer@xxxxxxxxxxxxx>, linux-pci@xxxxxxxxxxxxxxx, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Felipe Balbi <balbi@xxxxxxxxxx>, linux-usb@xxxxxxxxxxxxxxx, Kalle Valo <kvalo@xxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, linux-wireless@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, Darren Hart <dvhart@xxxxxxxxxxxxx>, Andy Shevchenko <andy@xxxxxxxxxxxxx>, platform-driver-x86@xxxxxxxxxxxxxxx, Zhang Rui <rui.zhang@xxxxxxxxx>, "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>, linux-pm@xxxxxxxxxxxxxxx, Len Brown <lenb@xxxxxxxxxx>, linux-acpi@xxxxxxxxxxxxxxx, kbuild test robot <lkp@xxxxxxxxx>, Nick Hu <nickhu@xxxxxxxxxxxxx>, Greentime Hu <green.hu@xxxxxxxxx>, Vincent Chen <deanbo422@xxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, linux-csky@xxxxxxxxxxxxxxx, Brian Cain <bcain@xxxxxxxxxxxxxx>, linux-hexagon@xxxxxxxxxxxxxxx, Tony Luck <tony.luck@xxxxxxxxx>, Fenghua Yu <fenghua.yu@xxxxxxxxx>, linux-ia64@xxxxxxxxxxxxxxx, Michal Simek <monstr@xxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Geoff Levand <geoff@xxxxxxxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx, "Paul E . McKenney" <paulmck@xxxxxxxxxx>, Jonathan Corbet <corbet@xxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, Davidlohr Bueso <dbueso@xxxxxxx>
- References: <20200321112544.878032781@linutronix.de>
- User-agent: quilt/0.65
From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
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@xxxxxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
---
V2: Add comment to swake_up_all_locked()
---
kernel/sched/sched.h | 3 +++
kernel/sched/swait.c | 15 ++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2492,3 +2492,6 @@ static inline bool is_per_cpu_kthread(st
return true;
}
#endif
+
+void swake_up_all_locked(struct swait_queue_head *q);
+void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait);
--- a/kernel/sched/swait.c
+++ b/kernel/sched/swait.c
@@ -32,6 +32,19 @@ void swake_up_locked(struct swait_queue_
}
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_hea
}
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))
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]