hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/kernel/sched/swait.c
....@@ -32,24 +32,18 @@
3232 }
3333 EXPORT_SYMBOL(swake_up_locked);
3434
35
+/*
36
+ * Wake up all waiters. This is an interface which is solely exposed for
37
+ * completions and not for general usage.
38
+ *
39
+ * It is intentionally different from swake_up_all() to allow usage from
40
+ * hard interrupt context and interrupt disabled regions.
41
+ */
3542 void swake_up_all_locked(struct swait_queue_head *q)
3643 {
37
- struct swait_queue *curr;
38
- int wakes = 0;
39
-
40
- while (!list_empty(&q->task_list)) {
41
-
42
- curr = list_first_entry(&q->task_list, typeof(*curr),
43
- task_list);
44
- wake_up_process(curr->task);
45
- list_del_init(&curr->task_list);
46
- wakes++;
47
- }
48
- if (pm_in_action)
49
- return;
50
- WARN(wakes > 2, "complete_all() with %d waiters\n", wakes);
44
+ while (!list_empty(&q->task_list))
45
+ swake_up_locked(q);
5146 }
52
-EXPORT_SYMBOL(swake_up_all_locked);
5347
5448 void swake_up_one(struct swait_queue_head *q)
5549 {
....@@ -70,7 +64,6 @@
7064 struct swait_queue *curr;
7165 LIST_HEAD(tmp);
7266
73
- WARN_ON(irqs_disabled());
7467 raw_spin_lock_irq(&q->lock);
7568 list_splice_init(&q->task_list, &tmp);
7669 while (!list_empty(&tmp)) {
....@@ -113,7 +106,7 @@
113106 long ret = 0;
114107
115108 raw_spin_lock_irqsave(&q->lock, flags);
116
- if (unlikely(signal_pending_state(state, current))) {
109
+ if (signal_pending_state(state, current)) {
117110 /*
118111 * See prepare_to_wait_event(). TL;DR, subsequent swake_up_one()
119112 * must not see us.