aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/wait.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/wait.c')
-rw-r--r--kernel/sched/wait.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 15cab1a4f84e..5a62915f47a8 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -343,6 +343,18 @@ int __sched out_of_line_wait_on_bit(void *word, int bit,
343} 343}
344EXPORT_SYMBOL(out_of_line_wait_on_bit); 344EXPORT_SYMBOL(out_of_line_wait_on_bit);
345 345
346int __sched out_of_line_wait_on_bit_timeout(
347 void *word, int bit, wait_bit_action_f *action,
348 unsigned mode, unsigned long timeout)
349{
350 wait_queue_head_t *wq = bit_waitqueue(word, bit);
351 DEFINE_WAIT_BIT(wait, word, bit);
352
353 wait.key.timeout = jiffies + timeout;
354 return __wait_on_bit(wq, &wait, action, mode);
355}
356EXPORT_SYMBOL_GPL(out_of_line_wait_on_bit_timeout);
357
346int __sched 358int __sched
347__wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, 359__wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q,
348 wait_bit_action_f *action, unsigned mode) 360 wait_bit_action_f *action, unsigned mode)
@@ -520,3 +532,27 @@ __sched int bit_wait_io(struct wait_bit_key *word)
520 return 0; 532 return 0;
521} 533}
522EXPORT_SYMBOL(bit_wait_io); 534EXPORT_SYMBOL(bit_wait_io);
535
536__sched int bit_wait_timeout(struct wait_bit_key *word)
537{
538 unsigned long now = ACCESS_ONCE(jiffies);
539 if (signal_pending_state(current->state, current))
540 return 1;
541 if (time_after_eq(now, word->timeout))
542 return -EAGAIN;
543 schedule_timeout(word->timeout - now);
544 return 0;
545}
546EXPORT_SYMBOL_GPL(bit_wait_timeout);
547
548__sched int bit_wait_io_timeout(struct wait_bit_key *word)
549{
550 unsigned long now = ACCESS_ONCE(jiffies);
551 if (signal_pending_state(current->state, current))
552 return 1;
553 if (time_after_eq(now, word->timeout))
554 return -EAGAIN;
555 io_schedule_timeout(word->timeout - now);
556 return 0;
557}
558EXPORT_SYMBOL_GPL(bit_wait_io_timeout);