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
167 __acquires(&timer->base->lock) in lock_hrtimer_base()
172 base = READ_ONCE(timer->base); in lock_hrtimer_base()
175 if (likely(base == timer->base)) in lock_hrtimer_base()
177 /* The timer has migrated to another CPU: */ in lock_hrtimer_base()
185 * We do not migrate the timer when it is expiring before the next
194 hrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base) in hrtimer_check_target() argument
198 expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset); in hrtimer_check_target()
214 * We switch the timer base to a power-optimized selected CPU target,
217 * - timer migration is enabled
218 * - the timer callback is not running
219 * - the timer is not the first expiring timer on the new target
221 * If one of the above requirements is not fulfilled we move the timer
223 * the timer callback is currently running.
226 switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, in switch_hrtimer_base() argument
240 * We are trying to move timer to new_base. in switch_hrtimer_base()
241 * However we can't change timer's base while it is running, in switch_hrtimer_base()
244 * code will take care of this when the timer function has in switch_hrtimer_base()
246 * the timer is enqueued. in switch_hrtimer_base()
248 if (unlikely(hrtimer_callback_running(timer))) in switch_hrtimer_base()
252 WRITE_ONCE(timer->base, &migration_base); in switch_hrtimer_base()
257 hrtimer_check_target(timer, new_base)) { in switch_hrtimer_base()
261 WRITE_ONCE(timer->base, base); in switch_hrtimer_base()
264 WRITE_ONCE(timer->base, new_base); in switch_hrtimer_base()
267 hrtimer_check_target(timer, new_base)) { in switch_hrtimer_base()
283 lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) in lock_hrtimer_base() argument
284 __acquires(&timer->base->cpu_base->lock) in lock_hrtimer_base()
286 struct hrtimer_clock_base *base = timer->base; in lock_hrtimer_base()
360 struct hrtimer *timer = addr; in hrtimer_fixup_init() local
364 hrtimer_cancel(timer); in hrtimer_fixup_init()
365 debug_object_init(timer, &hrtimer_debug_descr); in hrtimer_fixup_init()
394 struct hrtimer *timer = addr; in hrtimer_fixup_free() local
398 hrtimer_cancel(timer); in hrtimer_fixup_free()
399 debug_object_free(timer, &hrtimer_debug_descr); in hrtimer_fixup_free()
414 static inline void debug_hrtimer_init(struct hrtimer *timer) in debug_hrtimer_init() argument
416 debug_object_init(timer, &hrtimer_debug_descr); in debug_hrtimer_init()
419 static inline void debug_hrtimer_activate(struct hrtimer *timer, in debug_hrtimer_activate() argument
422 debug_object_activate(timer, &hrtimer_debug_descr); in debug_hrtimer_activate()
425 static inline void debug_hrtimer_deactivate(struct hrtimer *timer) in debug_hrtimer_deactivate() argument
427 debug_object_deactivate(timer, &hrtimer_debug_descr); in debug_hrtimer_deactivate()
430 static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
433 void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, in hrtimer_init_on_stack() argument
436 debug_object_init_on_stack(timer, &hrtimer_debug_descr); in hrtimer_init_on_stack()
437 __hrtimer_init(timer, clock_id, mode); in hrtimer_init_on_stack()
447 debug_object_init_on_stack(&sl->timer, &hrtimer_debug_descr); in hrtimer_init_sleeper_on_stack()
452 void destroy_hrtimer_on_stack(struct hrtimer *timer) in destroy_hrtimer_on_stack() argument
454 debug_object_free(timer, &hrtimer_debug_descr); in destroy_hrtimer_on_stack()
460 static inline void debug_hrtimer_init(struct hrtimer *timer) { } in debug_hrtimer_init() argument
461 static inline void debug_hrtimer_activate(struct hrtimer *timer, in debug_hrtimer_activate() argument
463 static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } in debug_hrtimer_deactivate() argument
467 debug_init(struct hrtimer *timer, clockid_t clockid, in debug_init() argument
470 debug_hrtimer_init(timer); in debug_init()
471 trace_hrtimer_init(timer, clockid, mode); in debug_init()
474 static inline void debug_activate(struct hrtimer *timer, in debug_activate() argument
477 debug_hrtimer_activate(timer, mode); in debug_activate()
478 trace_hrtimer_start(timer, mode); in debug_activate()
481 static inline void debug_deactivate(struct hrtimer *timer) in debug_deactivate() argument
483 debug_hrtimer_deactivate(timer); in debug_deactivate()
484 trace_hrtimer_cancel(timer); in debug_deactivate()
514 struct hrtimer *timer; in __hrtimer_next_event_base() local
517 timer = container_of(next, struct hrtimer, node); in __hrtimer_next_event_base()
518 if (timer == exclude) { in __hrtimer_next_event_base()
519 /* Get to the next timer in the queue. */ in __hrtimer_next_event_base()
524 timer = container_of(next, struct hrtimer, node); in __hrtimer_next_event_base()
526 expires = ktime_sub(hrtimer_get_expires(timer), base->offset); in __hrtimer_next_event_base()
530 /* Skip cpu_base update if a timer is being excluded. */ in __hrtimer_next_event_base()
534 if (timer->is_soft) in __hrtimer_next_event_base()
535 cpu_base->softirq_next_timer = timer; in __hrtimer_next_event_base()
537 cpu_base->next_timer = timer; in __hrtimer_next_event_base()
616 * If a softirq timer is expiring first, update cpu_base->next_timer in hrtimer_update_next_event()
667 * If a hang was detected in the last timer interrupt then we in __hrtimer_reprogram()
704 /* High resolution timer related functions */
708 * High resolution timer enabled ?
782 * If high resolution mode is active then the next expiring timer in retrigger_next_event()
787 * of the next expiring timer is enough. The return from the SMP in retrigger_next_event()
804 * When a timer is enqueued and expires earlier than the already enqueued
805 * timers, we have to check, whether it expires earlier than the timer for
810 static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram) in hrtimer_reprogram() argument
813 struct hrtimer_clock_base *base = timer->base; in hrtimer_reprogram()
814 ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset); in hrtimer_reprogram()
816 WARN_ON_ONCE(hrtimer_get_expires_tv64(timer) < 0); in hrtimer_reprogram()
819 * CLOCK_REALTIME timer might be requested with an absolute in hrtimer_reprogram()
825 if (timer->is_soft) { in hrtimer_reprogram()
841 timer_cpu_base->softirq_next_timer = timer; in hrtimer_reprogram()
850 * If the timer is not on the current cpu, we cannot reprogram in hrtimer_reprogram()
866 cpu_base->next_timer = timer; in hrtimer_reprogram()
868 __hrtimer_reprogram(cpu_base, timer, expires); in hrtimer_reprogram()
886 * the next expiring timer. in update_needs_ipi()
900 * will reevaluate the first expiring timer of all clock bases in update_needs_ipi()
908 * timer in a clock base is moving ahead of the first expiring timer of in update_needs_ipi()
940 * when the change moves an affected timer ahead of the first expiring
941 * timer on that CPU. Obviously remote per CPU clock event devices cannot
1017 void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) in unlock_hrtimer_base() argument
1018 __releases(&timer->base->cpu_base->lock) in unlock_hrtimer_base()
1020 raw_spin_unlock_irqrestore(&timer->base->cpu_base->lock, *flags); in unlock_hrtimer_base()
1024 * hrtimer_forward - forward the timer expiry
1025 * @timer: hrtimer to forward
1029 * Forward the timer expiry so it will expire in the future.
1032 * Can be safely called from the callback function of @timer. If
1033 * called from other contexts @timer must neither be enqueued nor
1037 * Note: This only updates the timer expiry value and does not requeue
1038 * the timer.
1040 u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) in hrtimer_forward() argument
1045 delta = ktime_sub(now, hrtimer_get_expires(timer)); in hrtimer_forward()
1050 if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED)) in hrtimer_forward()
1060 hrtimer_add_expires_ns(timer, incr * orun); in hrtimer_forward()
1061 if (hrtimer_get_expires_tv64(timer) > now) in hrtimer_forward()
1069 hrtimer_add_expires(timer, interval); in hrtimer_forward()
1076 * enqueue_hrtimer - internal function to (re)start a timer
1078 * The timer is inserted in expiry order. Insertion into the
1081 * Returns 1 when the new timer is the leftmost timer in the tree.
1083 static int enqueue_hrtimer(struct hrtimer *timer, in enqueue_hrtimer() argument
1087 debug_activate(timer, mode); in enqueue_hrtimer()
1092 WRITE_ONCE(timer->state, HRTIMER_STATE_ENQUEUED); in enqueue_hrtimer()
1094 return timerqueue_add(&base->active, &timer->node); in enqueue_hrtimer()
1098 * __remove_hrtimer - internal function to remove a timer
1102 * High resolution timer mode reprograms the clock event device when the
1103 * timer is the one which expires next. The caller can disable this by setting
1105 * anyway (e.g. timer interrupt)
1107 static void __remove_hrtimer(struct hrtimer *timer, in __remove_hrtimer() argument
1112 u8 state = timer->state; in __remove_hrtimer()
1115 WRITE_ONCE(timer->state, newstate); in __remove_hrtimer()
1119 if (!timerqueue_del(&base->active, &timer->node)) in __remove_hrtimer()
1125 * timer on a remote cpu. No harm as we never dereference in __remove_hrtimer()
1128 * remote cpu later on if the same timer gets enqueued again. in __remove_hrtimer()
1130 if (reprogram && timer == cpu_base->next_timer) in __remove_hrtimer()
1138 remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, in remove_hrtimer() argument
1141 u8 state = timer->state; in remove_hrtimer()
1147 * Remove the timer and force reprogramming when high in remove_hrtimer()
1148 * resolution mode is active and the timer is on the current in remove_hrtimer()
1149 * CPU. If we remove a timer on another CPU, reprogramming is in remove_hrtimer()
1154 debug_deactivate(timer); in remove_hrtimer()
1158 * If the timer is not restarted then reprogramming is in remove_hrtimer()
1159 * required if the timer is local. If it is local and about in remove_hrtimer()
1168 __remove_hrtimer(timer, base, state, reprogram); in remove_hrtimer()
1174 static inline ktime_t hrtimer_update_lowres(struct hrtimer *timer, ktime_t tim, in hrtimer_update_lowres() argument
1183 timer->is_rel = mode & HRTIMER_MODE_REL; in hrtimer_update_lowres()
1184 if (timer->is_rel) in hrtimer_update_lowres()
1215 static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, in __hrtimer_start_range_ns() argument
1223 * If the timer is on the local cpu base and is the first expiring in __hrtimer_start_range_ns()
1224 * timer then this might end up reprogramming the hardware twice in __hrtimer_start_range_ns()
1226 * reprogram on removal, keep the timer local to the current CPU in __hrtimer_start_range_ns()
1228 * it is the new first expiring timer again or not. in __hrtimer_start_range_ns()
1231 force_local &= base->cpu_base->next_timer == timer; in __hrtimer_start_range_ns()
1234 * Remove an active timer from the queue. In case it is not queued in __hrtimer_start_range_ns()
1238 * If it's on the current CPU and the first expiring timer, then in __hrtimer_start_range_ns()
1239 * skip reprogramming, keep the timer local and enforce in __hrtimer_start_range_ns()
1240 * reprogramming later if it was the first expiring timer. This in __hrtimer_start_range_ns()
1244 remove_hrtimer(timer, base, true, force_local); in __hrtimer_start_range_ns()
1249 tim = hrtimer_update_lowres(timer, tim, mode); in __hrtimer_start_range_ns()
1251 hrtimer_set_expires_range_ns(timer, tim, delta_ns); in __hrtimer_start_range_ns()
1253 /* Switch the timer base, if necessary: */ in __hrtimer_start_range_ns()
1255 new_base = switch_hrtimer_base(timer, base, in __hrtimer_start_range_ns()
1261 first = enqueue_hrtimer(timer, new_base, mode); in __hrtimer_start_range_ns()
1266 * Timer was forced to stay on the current CPU to avoid in __hrtimer_start_range_ns()
1268 * hardware by evaluating the new first expiring timer. in __hrtimer_start_range_ns()
1276 * @timer: the timer to be added
1278 * @delta_ns: "slack" range for the timer
1279 * @mode: timer mode: absolute (HRTIMER_MODE_ABS) or
1283 void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, in hrtimer_start_range_ns() argument
1295 WARN_ON_ONCE(!(mode & HRTIMER_MODE_SOFT) ^ !timer->is_soft); in hrtimer_start_range_ns()
1297 WARN_ON_ONCE(!(mode & HRTIMER_MODE_HARD) ^ !timer->is_hard); in hrtimer_start_range_ns()
1299 base = lock_hrtimer_base(timer, &flags); in hrtimer_start_range_ns()
1301 if (__hrtimer_start_range_ns(timer, tim, delta_ns, mode, base)) in hrtimer_start_range_ns()
1302 hrtimer_reprogram(timer, true); in hrtimer_start_range_ns()
1304 unlock_hrtimer_base(timer, &flags); in hrtimer_start_range_ns()
1309 * hrtimer_try_to_cancel - try to deactivate a timer
1310 * @timer: hrtimer to stop
1314 * * 0 when the timer was not active
1315 * * 1 when the timer was active
1316 * * -1 when the timer is currently executing the callback function and
1319 int hrtimer_try_to_cancel(struct hrtimer *timer) in hrtimer_try_to_cancel() argument
1326 * Check lockless first. If the timer is not active (neither in hrtimer_try_to_cancel()
1331 if (!hrtimer_active(timer)) in hrtimer_try_to_cancel()
1334 base = lock_hrtimer_base(timer, &flags); in hrtimer_try_to_cancel()
1336 if (!hrtimer_callback_running(timer)) in hrtimer_try_to_cancel()
1337 ret = remove_hrtimer(timer, base, false, false); in hrtimer_try_to_cancel()
1339 unlock_hrtimer_base(timer, &flags); in hrtimer_try_to_cancel()
1366 * the timer callback to finish. Drop expiry_lock and reacquire it. That
1382 * deletion of a timer failed because the timer callback function was
1386 * in the middle of a timer callback, then calling del_timer_sync() can
1389 * - If the caller is on a remote CPU then it has to spin wait for the timer
1392 * - If the caller originates from the task which preempted the timer
1393 * handler on the same CPU, then spin waiting for the timer handler to
1396 void hrtimer_cancel_wait_running(const struct hrtimer *timer) in hrtimer_cancel_wait_running() argument
1399 struct hrtimer_clock_base *base = READ_ONCE(timer->base); in hrtimer_cancel_wait_running()
1402 * Just relax if the timer expires in hard interrupt context or if in hrtimer_cancel_wait_running()
1405 if (!timer->is_soft || is_migration_base(base)) { in hrtimer_cancel_wait_running()
1412 * held by the softirq across the timer callback. Drop the lock in hrtimer_cancel_wait_running()
1413 * immediately so the softirq can expire the next timer. In theory in hrtimer_cancel_wait_running()
1414 * the timer could already be running again, but that's more than in hrtimer_cancel_wait_running()
1434 * hrtimer_cancel - cancel a timer and wait for the handler to finish.
1435 * @timer: the timer to be cancelled
1438 * 0 when the timer was not active
1439 * 1 when the timer was active
1441 int hrtimer_cancel(struct hrtimer *timer) in hrtimer_cancel() argument
1446 ret = hrtimer_try_to_cancel(timer); in hrtimer_cancel()
1449 hrtimer_cancel_wait_running(timer); in hrtimer_cancel()
1456 * __hrtimer_get_remaining - get remaining time for the timer
1457 * @timer: the timer to read
1460 ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust) in __hrtimer_get_remaining() argument
1465 lock_hrtimer_base(timer, &flags); in __hrtimer_get_remaining()
1467 rem = hrtimer_expires_remaining_adjusted(timer); in __hrtimer_get_remaining()
1469 rem = hrtimer_expires_remaining(timer); in __hrtimer_get_remaining()
1470 unlock_hrtimer_base(timer, &flags); in __hrtimer_get_remaining()
1480 * Returns the next expiry time or KTIME_MAX if no timer is pending.
1499 * hrtimer_next_event_without - time until next expiry event w/o one timer
1500 * @exclude: timer to exclude
1544 static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, in __hrtimer_init() argument
1560 memset(timer, 0, sizeof(struct hrtimer)); in __hrtimer_init()
1574 timer->is_soft = softtimer; in __hrtimer_init()
1575 timer->is_hard = !!(mode & HRTIMER_MODE_HARD); in __hrtimer_init()
1576 timer->base = &cpu_base->clock_base[base]; in __hrtimer_init()
1577 timerqueue_init(&timer->node); in __hrtimer_init()
1581 * hrtimer_init - initialize a timer to the given clock
1582 * @timer: the timer to be initialized
1592 void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, in hrtimer_init() argument
1595 debug_init(timer, clock_id, mode); in hrtimer_init()
1596 __hrtimer_init(timer, clock_id, mode); in hrtimer_init()
1601 * A timer is active, when it is enqueued into the rbtree or the
1607 bool hrtimer_active(const struct hrtimer *timer) in hrtimer_active() argument
1613 base = READ_ONCE(timer->base); in hrtimer_active()
1616 if (timer->state != HRTIMER_STATE_INACTIVE || in hrtimer_active()
1617 base->running == timer) in hrtimer_active()
1621 base != READ_ONCE(timer->base)); in hrtimer_active()
1631 * - queued: the timer is queued
1632 * - callback: the timer is being ran
1633 * - post: the timer is inactive or (re)queued
1635 * On the read side we ensure we observe timer->state and cpu_base->running
1637 * This includes timer->base changing because sequence numbers alone are
1647 struct hrtimer *timer, ktime_t *now, in __run_hrtimer() argument
1656 debug_deactivate(timer); in __run_hrtimer()
1657 base->running = timer; in __run_hrtimer()
1664 * timer->state == INACTIVE. in __run_hrtimer()
1668 __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, 0); in __run_hrtimer()
1669 fn = timer->function; in __run_hrtimer()
1673 * timer is restarted with a period then it becomes an absolute in __run_hrtimer()
1674 * timer. If its not restarted it does not matter. in __run_hrtimer()
1677 timer->is_rel = false; in __run_hrtimer()
1680 * The timer is marked as running in the CPU base, so it is in __run_hrtimer()
1685 trace_hrtimer_expire_entry(timer, now); in __run_hrtimer()
1686 expires_in_hardirq = lockdep_hrtimer_enter(timer); in __run_hrtimer()
1688 restart = fn(timer); in __run_hrtimer()
1691 trace_hrtimer_expire_exit(timer); in __run_hrtimer()
1700 * hrtimer_start_range_ns() can have popped in and enqueued the timer in __run_hrtimer()
1704 !(timer->state & HRTIMER_STATE_ENQUEUED)) in __run_hrtimer()
1705 enqueue_hrtimer(timer, base, HRTIMER_MODE_ABS); in __run_hrtimer()
1711 * hrtimer_active() cannot observe base->running.timer == NULL && in __run_hrtimer()
1712 * timer->state == INACTIVE. in __run_hrtimer()
1716 WARN_ON_ONCE(base->running != timer); in __run_hrtimer()
1733 struct hrtimer *timer; in __hrtimer_run_queues() local
1735 timer = container_of(node, struct hrtimer, node); in __hrtimer_run_queues()
1746 * are right-of a not yet expired timer, because that in __hrtimer_run_queues()
1747 * timer will have to trigger a wakeup anyway. in __hrtimer_run_queues()
1749 if (basenow < hrtimer_get_softexpires_tv64(timer)) in __hrtimer_run_queues()
1752 __run_hrtimer(cpu_base, base, timer, &basenow, flags); in __hrtimer_run_queues()
1781 * High resolution timer interrupt
1801 * held to prevent that a timer is enqueued in our queue via in hrtimer_interrupt()
1833 * The next timer was already expired due to: in hrtimer_interrupt()
1934 static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer) in hrtimer_wakeup() argument
1937 container_of(timer, struct hrtimer_sleeper, timer); in hrtimer_wakeup()
1948 * hrtimer_sleeper_start_expires - Start a hrtimer sleeper timer
1950 * @mode: timer mode abs/rel
1965 if (IS_ENABLED(CONFIG_PREEMPT_RT) && sl->timer.is_hard) in hrtimer_sleeper_start_expires()
1968 hrtimer_start_expires(&sl->timer, mode); in hrtimer_sleeper_start_expires()
1999 __hrtimer_init(&sl->timer, clock_id, mode); in __hrtimer_init_sleeper()
2000 sl->timer.function = hrtimer_wakeup; in __hrtimer_init_sleeper()
2008 * @mode: timer mode abs/rel
2013 debug_init(&sl->timer, clock_id, mode); in hrtimer_init_sleeper()
2049 hrtimer_cancel(&t->timer); in do_nanosleep()
2061 ktime_t rem = hrtimer_expires_remaining(&t->timer); in do_nanosleep()
2080 hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires); in hrtimer_nanosleep_restart()
2082 destroy_hrtimer_on_stack(&t.timer); in hrtimer_nanosleep_restart()
2099 hrtimer_set_expires_range_ns(&t.timer, rqtp, slack); in hrtimer_nanosleep()
2111 restart->nanosleep.clockid = t.timer.base->clockid; in hrtimer_nanosleep()
2112 restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer); in hrtimer_nanosleep()
2115 destroy_hrtimer_on_stack(&t.timer); in hrtimer_nanosleep()
2195 struct hrtimer *timer; in migrate_hrtimer_list() local
2199 timer = container_of(node, struct hrtimer, node); in migrate_hrtimer_list()
2200 BUG_ON(hrtimer_callback_running(timer)); in migrate_hrtimer_list()
2201 debug_deactivate(timer); in migrate_hrtimer_list()
2205 * timer could be seen as !active and just vanish away in migrate_hrtimer_list()
2208 __remove_hrtimer(timer, old_base, HRTIMER_STATE_ENQUEUED, 0); in migrate_hrtimer_list()
2209 timer->base = new_base; in migrate_hrtimer_list()
2212 * reprogram the event device in case the timer in migrate_hrtimer_list()
2218 enqueue_hrtimer(timer, new_base, HRTIMER_MODE_ABS); in migrate_hrtimer_list()
2253 * timer on this CPU. Update it. in hrtimers_dead_cpu()
2279 * @mode: timer mode
2280 * @clock_id: timer clock to be used
2313 hrtimer_set_expires_range_ns(&t.timer, *expires, delta); in schedule_hrtimeout_range_clock()
2319 hrtimer_cancel(&t.timer); in schedule_hrtimeout_range_clock()
2320 destroy_hrtimer_on_stack(&t.timer); in schedule_hrtimeout_range_clock()
2332 * @mode: timer mode
2342 * but may decide to fire the timer earlier, but no earlier than @expires.
2357 * Returns 0 when the timer has expired. If the task was woken before the
2358 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or
2372 * @mode: timer mode
2391 * Returns 0 when the timer has expired. If the task was woken before the
2392 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or