@@ -7970,22 +7970,12 @@ static int md_thread(void *arg)
* many dirty RAID5 blocks.
*/
- allow_signal(SIGKILL);
while (!kthread_should_stop()) {
- /* We need to wait INTERRUPTIBLE so that
- * we don't add to the load-average.
- * That means we need to be sure no signals are
- * pending
- */
- if (signal_pending(current))
- flush_signals(current);
-
- wait_event_interruptible_timeout
- (thread->wqueue,
- test_bit(THREAD_WAKEUP, &thread->flags)
- || kthread_should_stop() || kthread_should_park(),
- thread->timeout);
+ swait_event_idle_timeout_exclusive(thread->wqueue,
+ test_bit(THREAD_WAKEUP, &thread->flags) ||
+ kthread_should_stop() || kthread_should_park(),
+ thread->timeout);
clear_bit(THREAD_WAKEUP, &thread->flags);
if (kthread_should_park())
@@ -8017,7 +8007,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)
if (t) {
pr_debug("md: waking up MD thread %s.\n", t->tsk->comm);
set_bit(THREAD_WAKEUP, &t->flags);
- wake_up(&t->wqueue);
+ if (swq_has_sleeper(&thread->wqueue))
+ swake_up_one(&thread->wqueue);
}
rcu_read_unlock();
}
@@ -8032,7 +8023,7 @@ struct md_thread *md_register_thread(void (*run) (struct md_thread *),
if (!thread)
return NULL;
- init_waitqueue_head(&thread->wqueue);
+ init_swait_queue_head(&thread->wqueue);
thread->run = run;
thread->mddev = mddev;
@@ -716,7 +716,7 @@ static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev)
struct md_thread {
void (*run) (struct md_thread *thread);
struct mddev *mddev;
- wait_queue_head_t wqueue;
+ struct swait_queue_head wqueue;
unsigned long flags;
struct task_struct *tsk;
unsigned long timeout;