Lines Matching full:timer

9  *  In contrast to the low-resolution timeout API, aka timer wheel,
16 * Based on the original timer wheel code
41 #include <linux/timer.h>
47 #include <trace/events/timer.h>
61 * The timer bases:
64 * into the timer bases by the hrtimer_base_type enum. When trying
135 * timer->base->cpu_base
154 * means that all timers which are tied to this base via timer->base are
160 * When the timer's base is locked, and the timer removed from list, it is
161 * possible to set timer->base = &migration_base and drop the lock: the timer
165 struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, in lock_hrtimer_base() argument
171 base = READ_ONCE(timer->base); in lock_hrtimer_base()
174 if (likely(base == timer->base)) in lock_hrtimer_base()
176 /* The timer has migrated to another CPU: */ in lock_hrtimer_base()
184 * We do not migrate the timer when it is expiring before the next
193 hrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base) in hrtimer_check_target() argument
197 expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset); in hrtimer_check_target()
213 * We switch the timer base to a power-optimized selected CPU target,
216 * - timer migration is enabled
217 * - the timer callback is not running
218 * - the timer is not the first expiring timer on the new target
220 * If one of the above requirements is not fulfilled we move the timer
222 * the timer callback is currently running.
225 switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, in switch_hrtimer_base() argument
239 * We are trying to move timer to new_base. in switch_hrtimer_base()
240 * However we can't change timer's base while it is running, in switch_hrtimer_base()
243 * code will take care of this when the timer function has in switch_hrtimer_base()
245 * the timer is enqueued. in switch_hrtimer_base()
247 if (unlikely(hrtimer_callback_running(timer))) in switch_hrtimer_base()
251 WRITE_ONCE(timer->base, &migration_base); in switch_hrtimer_base()
256 hrtimer_check_target(timer, new_base)) { in switch_hrtimer_base()
260 WRITE_ONCE(timer->base, base); in switch_hrtimer_base()
263 WRITE_ONCE(timer->base, new_base); in switch_hrtimer_base()
266 hrtimer_check_target(timer, new_base)) { in switch_hrtimer_base()
282 lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) in lock_hrtimer_base() argument
284 struct hrtimer_clock_base *base = timer->base; in lock_hrtimer_base()
358 struct hrtimer *timer = addr; in hrtimer_fixup_init() local
362 hrtimer_cancel(timer); in hrtimer_fixup_init()
363 debug_object_init(timer, &hrtimer_debug_descr); in hrtimer_fixup_init()
392 struct hrtimer *timer = addr; in hrtimer_fixup_free() local
396 hrtimer_cancel(timer); in hrtimer_fixup_free()
397 debug_object_free(timer, &hrtimer_debug_descr); in hrtimer_fixup_free()
412 static inline void debug_hrtimer_init(struct hrtimer *timer) in debug_hrtimer_init() argument
414 debug_object_init(timer, &hrtimer_debug_descr); in debug_hrtimer_init()
417 static inline void debug_hrtimer_activate(struct hrtimer *timer, in debug_hrtimer_activate() argument
420 debug_object_activate(timer, &hrtimer_debug_descr); in debug_hrtimer_activate()
423 static inline void debug_hrtimer_deactivate(struct hrtimer *timer) in debug_hrtimer_deactivate() argument
425 debug_object_deactivate(timer, &hrtimer_debug_descr); in debug_hrtimer_deactivate()
428 static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
431 void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, in hrtimer_init_on_stack() argument
434 debug_object_init_on_stack(timer, &hrtimer_debug_descr); in hrtimer_init_on_stack()
435 __hrtimer_init(timer, clock_id, mode); in hrtimer_init_on_stack()
445 debug_object_init_on_stack(&sl->timer, &hrtimer_debug_descr); in hrtimer_init_sleeper_on_stack()
450 void destroy_hrtimer_on_stack(struct hrtimer *timer) in destroy_hrtimer_on_stack() argument
452 debug_object_free(timer, &hrtimer_debug_descr); in destroy_hrtimer_on_stack()
458 static inline void debug_hrtimer_init(struct hrtimer *timer) { } in debug_hrtimer_init() argument
459 static inline void debug_hrtimer_activate(struct hrtimer *timer, in debug_hrtimer_activate() argument
461 static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } in debug_hrtimer_deactivate() argument
465 debug_init(struct hrtimer *timer, clockid_t clockid, in debug_init() argument
468 debug_hrtimer_init(timer); in debug_init()
469 trace_hrtimer_init(timer, clockid, mode); in debug_init()
472 static inline void debug_activate(struct hrtimer *timer, in debug_activate() argument
475 debug_hrtimer_activate(timer, mode); in debug_activate()
476 trace_hrtimer_start(timer, mode); in debug_activate()
479 static inline void debug_deactivate(struct hrtimer *timer) in debug_deactivate() argument
481 debug_hrtimer_deactivate(timer); in debug_deactivate()
482 trace_hrtimer_cancel(timer); in debug_deactivate()
512 struct hrtimer *timer; in __hrtimer_next_event_base() local
515 timer = container_of(next, struct hrtimer, node); in __hrtimer_next_event_base()
516 if (timer == exclude) { in __hrtimer_next_event_base()
517 /* Get to the next timer in the queue. */ in __hrtimer_next_event_base()
522 timer = container_of(next, struct hrtimer, node); in __hrtimer_next_event_base()
524 expires = ktime_sub(hrtimer_get_expires(timer), base->offset); in __hrtimer_next_event_base()
528 /* Skip cpu_base update if a timer is being excluded. */ in __hrtimer_next_event_base()
532 if (timer->is_soft) in __hrtimer_next_event_base()
533 cpu_base->softirq_next_timer = timer; in __hrtimer_next_event_base()
535 cpu_base->next_timer = timer; in __hrtimer_next_event_base()
614 * If a softirq timer is expiring first, update cpu_base->next_timer in hrtimer_update_next_event()
665 * If a hang was detected in the last timer interrupt then we in __hrtimer_reprogram()
702 /* High resolution timer related functions */
706 * High resolution timer enabled ?
780 * If high resolution mode is active then the next expiring timer in retrigger_next_event()
785 * of the next expiring timer is enough. The return from the SMP in retrigger_next_event()
802 * When a timer is enqueued and expires earlier than the already enqueued
803 * timers, we have to check, whether it expires earlier than the timer for
808 static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram) in hrtimer_reprogram() argument
811 struct hrtimer_clock_base *base = timer->base; in hrtimer_reprogram()
812 ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset); in hrtimer_reprogram()
814 WARN_ON_ONCE(hrtimer_get_expires_tv64(timer) < 0); in hrtimer_reprogram()
817 * CLOCK_REALTIME timer might be requested with an absolute in hrtimer_reprogram()
823 if (timer->is_soft) { in hrtimer_reprogram()
839 timer_cpu_base->softirq_next_timer = timer; in hrtimer_reprogram()
848 * If the timer is not on the current cpu, we cannot reprogram in hrtimer_reprogram()
864 cpu_base->next_timer = timer; in hrtimer_reprogram()
866 __hrtimer_reprogram(cpu_base, timer, expires); in hrtimer_reprogram()
884 * the next expiring timer. in update_needs_ipi()
898 * will reevaluate the first expiring timer of all clock bases in update_needs_ipi()
906 * timer in a clock base is moving ahead of the first expiring timer of in update_needs_ipi()
938 * when the change moves an affected timer ahead of the first expiring
939 * timer on that CPU. Obviously remote per CPU clock event devices cannot
1015 void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) in unlock_hrtimer_base() argument
1017 raw_spin_unlock_irqrestore(&timer->base->cpu_base->lock, *flags); in unlock_hrtimer_base()
1021 * hrtimer_forward - forward the timer expiry
1022 * @timer: hrtimer to forward
1026 * Forward the timer expiry so it will expire in the future.
1029 * Can be safely called from the callback function of @timer. If
1030 * called from other contexts @timer must neither be enqueued nor
1034 * Note: This only updates the timer expiry value and does not requeue
1035 * the timer.
1037 u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) in hrtimer_forward() argument
1042 delta = ktime_sub(now, hrtimer_get_expires(timer)); in hrtimer_forward()
1047 if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED)) in hrtimer_forward()
1057 hrtimer_add_expires_ns(timer, incr * orun); in hrtimer_forward()
1058 if (hrtimer_get_expires_tv64(timer) > now) in hrtimer_forward()
1066 hrtimer_add_expires(timer, interval); in hrtimer_forward()
1073 * enqueue_hrtimer - internal function to (re)start a timer
1075 * The timer is inserted in expiry order. Insertion into the
1078 * Returns 1 when the new timer is the leftmost timer in the tree.
1080 static int enqueue_hrtimer(struct hrtimer *timer, in enqueue_hrtimer() argument
1084 debug_activate(timer, mode); in enqueue_hrtimer()
1089 WRITE_ONCE(timer->state, HRTIMER_STATE_ENQUEUED); in enqueue_hrtimer()
1091 return timerqueue_add(&base->active, &timer->node); in enqueue_hrtimer()
1095 * __remove_hrtimer - internal function to remove a timer
1099 * High resolution timer mode reprograms the clock event device when the
1100 * timer is the one which expires next. The caller can disable this by setting
1102 * anyway (e.g. timer interrupt)
1104 static void __remove_hrtimer(struct hrtimer *timer, in __remove_hrtimer() argument
1109 u8 state = timer->state; in __remove_hrtimer()
1112 WRITE_ONCE(timer->state, newstate); in __remove_hrtimer()
1116 if (!timerqueue_del(&base->active, &timer->node)) in __remove_hrtimer()
1122 * timer on a remote cpu. No harm as we never dereference in __remove_hrtimer()
1125 * remote cpu later on if the same timer gets enqueued again. in __remove_hrtimer()
1127 if (reprogram && timer == cpu_base->next_timer) in __remove_hrtimer()
1135 remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, in remove_hrtimer() argument
1138 u8 state = timer->state; in remove_hrtimer()
1144 * Remove the timer and force reprogramming when high in remove_hrtimer()
1145 * resolution mode is active and the timer is on the current in remove_hrtimer()
1146 * CPU. If we remove a timer on another CPU, reprogramming is in remove_hrtimer()
1151 debug_deactivate(timer); in remove_hrtimer()
1155 * If the timer is not restarted then reprogramming is in remove_hrtimer()
1156 * required if the timer is local. If it is local and about in remove_hrtimer()
1165 __remove_hrtimer(timer, base, state, reprogram); in remove_hrtimer()
1171 static inline ktime_t hrtimer_update_lowres(struct hrtimer *timer, ktime_t tim, in hrtimer_update_lowres() argument
1180 timer->is_rel = mode & HRTIMER_MODE_REL; in hrtimer_update_lowres()
1181 if (timer->is_rel) in hrtimer_update_lowres()
1212 static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, in __hrtimer_start_range_ns() argument
1220 * If the timer is on the local cpu base and is the first expiring in __hrtimer_start_range_ns()
1221 * timer then this might end up reprogramming the hardware twice in __hrtimer_start_range_ns()
1223 * reprogram on removal, keep the timer local to the current CPU in __hrtimer_start_range_ns()
1225 * it is the new first expiring timer again or not. in __hrtimer_start_range_ns()
1228 force_local &= base->cpu_base->next_timer == timer; in __hrtimer_start_range_ns()
1231 * Remove an active timer from the queue. In case it is not queued in __hrtimer_start_range_ns()
1235 * If it's on the current CPU and the first expiring timer, then in __hrtimer_start_range_ns()
1236 * skip reprogramming, keep the timer local and enforce in __hrtimer_start_range_ns()
1237 * reprogramming later if it was the first expiring timer. This in __hrtimer_start_range_ns()
1241 remove_hrtimer(timer, base, true, force_local); in __hrtimer_start_range_ns()
1246 tim = hrtimer_update_lowres(timer, tim, mode); in __hrtimer_start_range_ns()
1248 hrtimer_set_expires_range_ns(timer, tim, delta_ns); in __hrtimer_start_range_ns()
1250 /* Switch the timer base, if necessary: */ in __hrtimer_start_range_ns()
1252 new_base = switch_hrtimer_base(timer, base, in __hrtimer_start_range_ns()
1258 first = enqueue_hrtimer(timer, new_base, mode); in __hrtimer_start_range_ns()
1263 * Timer was forced to stay on the current CPU to avoid in __hrtimer_start_range_ns()
1265 * hardware by evaluating the new first expiring timer. in __hrtimer_start_range_ns()
1273 * @timer: the timer to be added
1275 * @delta_ns: "slack" range for the timer
1276 * @mode: timer mode: absolute (HRTIMER_MODE_ABS) or
1280 void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, in hrtimer_start_range_ns() argument
1292 WARN_ON_ONCE(!(mode & HRTIMER_MODE_SOFT) ^ !timer->is_soft); in hrtimer_start_range_ns()
1294 WARN_ON_ONCE(!(mode & HRTIMER_MODE_HARD) ^ !timer->is_hard); in hrtimer_start_range_ns()
1296 base = lock_hrtimer_base(timer, &flags); in hrtimer_start_range_ns()
1298 if (__hrtimer_start_range_ns(timer, tim, delta_ns, mode, base)) in hrtimer_start_range_ns()
1299 hrtimer_reprogram(timer, true); in hrtimer_start_range_ns()
1301 unlock_hrtimer_base(timer, &flags); in hrtimer_start_range_ns()
1306 * hrtimer_try_to_cancel - try to deactivate a timer
1307 * @timer: hrtimer to stop
1311 * * 0 when the timer was not active
1312 * * 1 when the timer was active
1313 * * -1 when the timer is currently executing the callback function and
1316 int hrtimer_try_to_cancel(struct hrtimer *timer) in hrtimer_try_to_cancel() argument
1323 * Check lockless first. If the timer is not active (neither in hrtimer_try_to_cancel()
1328 if (!hrtimer_active(timer)) in hrtimer_try_to_cancel()
1331 base = lock_hrtimer_base(timer, &flags); in hrtimer_try_to_cancel()
1333 if (!hrtimer_callback_running(timer)) in hrtimer_try_to_cancel()
1334 ret = remove_hrtimer(timer, base, false, false); in hrtimer_try_to_cancel()
1336 unlock_hrtimer_base(timer, &flags); in hrtimer_try_to_cancel()
1363 * the timer callback to finish. Drop expiry_lock and reacquire it. That
1379 * deletion of a timer failed because the timer callback function was
1383 * in the middle of a timer callback, then calling del_timer_sync() can
1386 * - If the caller is on a remote CPU then it has to spin wait for the timer
1389 * - If the caller originates from the task which preempted the timer
1390 * handler on the same CPU, then spin waiting for the timer handler to
1393 void hrtimer_cancel_wait_running(const struct hrtimer *timer) in hrtimer_cancel_wait_running() argument
1396 struct hrtimer_clock_base *base = READ_ONCE(timer->base); in hrtimer_cancel_wait_running()
1399 * Just relax if the timer expires in hard interrupt context or if in hrtimer_cancel_wait_running()
1402 if (!timer->is_soft || is_migration_base(base)) { in hrtimer_cancel_wait_running()
1409 * held by the softirq across the timer callback. Drop the lock in hrtimer_cancel_wait_running()
1410 * immediately so the softirq can expire the next timer. In theory in hrtimer_cancel_wait_running()
1411 * the timer could already be running again, but that's more than in hrtimer_cancel_wait_running()
1431 * hrtimer_cancel - cancel a timer and wait for the handler to finish.
1432 * @timer: the timer to be cancelled
1435 * 0 when the timer was not active
1436 * 1 when the timer was active
1438 int hrtimer_cancel(struct hrtimer *timer) in hrtimer_cancel() argument
1443 ret = hrtimer_try_to_cancel(timer); in hrtimer_cancel()
1446 hrtimer_cancel_wait_running(timer); in hrtimer_cancel()
1453 * __hrtimer_get_remaining - get remaining time for the timer
1454 * @timer: the timer to read
1457 ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust) in __hrtimer_get_remaining() argument
1462 lock_hrtimer_base(timer, &flags); in __hrtimer_get_remaining()
1464 rem = hrtimer_expires_remaining_adjusted(timer); in __hrtimer_get_remaining()
1466 rem = hrtimer_expires_remaining(timer); in __hrtimer_get_remaining()
1467 unlock_hrtimer_base(timer, &flags); in __hrtimer_get_remaining()
1477 * Returns the next expiry time or KTIME_MAX if no timer is pending.
1496 * hrtimer_next_event_without - time until next expiry event w/o one timer
1497 * @exclude: timer to exclude
1541 static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, in __hrtimer_init() argument
1557 memset(timer, 0, sizeof(struct hrtimer)); in __hrtimer_init()
1571 timer->is_soft = softtimer; in __hrtimer_init()
1572 timer->is_hard = !!(mode & HRTIMER_MODE_HARD); in __hrtimer_init()
1573 timer->base = &cpu_base->clock_base[base]; in __hrtimer_init()
1574 timerqueue_init(&timer->node); in __hrtimer_init()
1578 * hrtimer_init - initialize a timer to the given clock
1579 * @timer: the timer to be initialized
1589 void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, in hrtimer_init() argument
1592 debug_init(timer, clock_id, mode); in hrtimer_init()
1593 __hrtimer_init(timer, clock_id, mode); in hrtimer_init()
1598 * A timer is active, when it is enqueued into the rbtree or the
1604 bool hrtimer_active(const struct hrtimer *timer) in hrtimer_active() argument
1610 base = READ_ONCE(timer->base); in hrtimer_active()
1613 if (timer->state != HRTIMER_STATE_INACTIVE || in hrtimer_active()
1614 base->running == timer) in hrtimer_active()
1618 base != READ_ONCE(timer->base)); in hrtimer_active()
1628 * - queued: the timer is queued
1629 * - callback: the timer is being ran
1630 * - post: the timer is inactive or (re)queued
1632 * On the read side we ensure we observe timer->state and cpu_base->running
1634 * This includes timer->base changing because sequence numbers alone are
1644 struct hrtimer *timer, ktime_t *now, in __run_hrtimer() argument
1653 debug_deactivate(timer); in __run_hrtimer()
1654 base->running = timer; in __run_hrtimer()
1661 * timer->state == INACTIVE. in __run_hrtimer()
1665 __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, 0); in __run_hrtimer()
1666 fn = timer->function; in __run_hrtimer()
1670 * timer is restarted with a period then it becomes an absolute in __run_hrtimer()
1671 * timer. If its not restarted it does not matter. in __run_hrtimer()
1674 timer->is_rel = false; in __run_hrtimer()
1677 * The timer is marked as running in the CPU base, so it is in __run_hrtimer()
1682 trace_hrtimer_expire_entry(timer, now); in __run_hrtimer()
1683 expires_in_hardirq = lockdep_hrtimer_enter(timer); in __run_hrtimer()
1685 restart = fn(timer); in __run_hrtimer()
1688 trace_hrtimer_expire_exit(timer); in __run_hrtimer()
1697 * hrtimer_start_range_ns() can have popped in and enqueued the timer in __run_hrtimer()
1701 !(timer->state & HRTIMER_STATE_ENQUEUED)) in __run_hrtimer()
1702 enqueue_hrtimer(timer, base, HRTIMER_MODE_ABS); in __run_hrtimer()
1708 * hrtimer_active() cannot observe base->running.timer == NULL && in __run_hrtimer()
1709 * timer->state == INACTIVE. in __run_hrtimer()
1713 WARN_ON_ONCE(base->running != timer); in __run_hrtimer()
1730 struct hrtimer *timer; in __hrtimer_run_queues() local
1732 timer = container_of(node, struct hrtimer, node); in __hrtimer_run_queues()
1743 * are right-of a not yet expired timer, because that in __hrtimer_run_queues()
1744 * timer will have to trigger a wakeup anyway. in __hrtimer_run_queues()
1746 if (basenow < hrtimer_get_softexpires_tv64(timer)) in __hrtimer_run_queues()
1749 __run_hrtimer(cpu_base, base, timer, &basenow, flags); in __hrtimer_run_queues()
1778 * High resolution timer interrupt
1798 * held to prevent that a timer is enqueued in our queue via in hrtimer_interrupt()
1830 * The next timer was already expired due to: in hrtimer_interrupt()
1931 static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer) in hrtimer_wakeup() argument
1934 container_of(timer, struct hrtimer_sleeper, timer); in hrtimer_wakeup()
1945 * hrtimer_sleeper_start_expires - Start a hrtimer sleeper timer
1947 * @mode: timer mode abs/rel
1962 if (IS_ENABLED(CONFIG_PREEMPT_RT) && sl->timer.is_hard) in hrtimer_sleeper_start_expires()
1965 hrtimer_start_expires(&sl->timer, mode); in hrtimer_sleeper_start_expires()
1996 __hrtimer_init(&sl->timer, clock_id, mode); in __hrtimer_init_sleeper()
1997 sl->timer.function = hrtimer_wakeup; in __hrtimer_init_sleeper()
2005 * @mode: timer mode abs/rel
2010 debug_init(&sl->timer, clock_id, mode); in hrtimer_init_sleeper()
2046 hrtimer_cancel(&t->timer); in do_nanosleep()
2058 ktime_t rem = hrtimer_expires_remaining(&t->timer); in do_nanosleep()
2077 hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires); in hrtimer_nanosleep_restart()
2079 destroy_hrtimer_on_stack(&t.timer); in hrtimer_nanosleep_restart()
2096 hrtimer_set_expires_range_ns(&t.timer, rqtp, slack); in hrtimer_nanosleep()
2108 restart->nanosleep.clockid = t.timer.base->clockid; in hrtimer_nanosleep()
2109 restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer); in hrtimer_nanosleep()
2112 destroy_hrtimer_on_stack(&t.timer); in hrtimer_nanosleep()
2190 struct hrtimer *timer; in migrate_hrtimer_list() local
2194 timer = container_of(node, struct hrtimer, node); in migrate_hrtimer_list()
2195 BUG_ON(hrtimer_callback_running(timer)); in migrate_hrtimer_list()
2196 debug_deactivate(timer); in migrate_hrtimer_list()
2200 * timer could be seen as !active and just vanish away in migrate_hrtimer_list()
2203 __remove_hrtimer(timer, old_base, HRTIMER_STATE_ENQUEUED, 0); in migrate_hrtimer_list()
2204 timer->base = new_base; in migrate_hrtimer_list()
2207 * reprogram the event device in case the timer in migrate_hrtimer_list()
2213 enqueue_hrtimer(timer, new_base, HRTIMER_MODE_ABS); in migrate_hrtimer_list()
2248 * timer on this CPU. Update it. in hrtimers_dead_cpu()
2274 * @mode: timer mode
2275 * @clock_id: timer clock to be used
2301 hrtimer_set_expires_range_ns(&t.timer, *expires, delta); in schedule_hrtimeout_range_clock()
2307 hrtimer_cancel(&t.timer); in schedule_hrtimeout_range_clock()
2308 destroy_hrtimer_on_stack(&t.timer); in schedule_hrtimeout_range_clock()
2319 * @mode: timer mode
2328 * but may decide to fire the timer earlier, but no earlier than @expires.
2343 * Returns 0 when the timer has expired. If the task was woken before the
2344 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or
2358 * @mode: timer mode
2377 * Returns 0 when the timer has expired. If the task was woken before the
2378 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or