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()
1093 WRITE_ONCE(timer->state, HRTIMER_STATE_ENQUEUED); in enqueue_hrtimer()
1095 return timerqueue_add(&base->active, &timer->node); in enqueue_hrtimer()
1099 * __remove_hrtimer - internal function to remove a timer
1103 * High resolution timer mode reprograms the clock event device when the
1104 * timer is the one which expires next. The caller can disable this by setting
1106 * anyway (e.g. timer interrupt)
1108 static void __remove_hrtimer(struct hrtimer *timer, in __remove_hrtimer() argument
1113 u8 state = timer->state; in __remove_hrtimer()
1116 WRITE_ONCE(timer->state, newstate); in __remove_hrtimer()
1120 if (!timerqueue_del(&base->active, &timer->node)) in __remove_hrtimer()
1126 * timer on a remote cpu. No harm as we never dereference in __remove_hrtimer()
1129 * remote cpu later on if the same timer gets enqueued again. in __remove_hrtimer()
1131 if (reprogram && timer == cpu_base->next_timer) in __remove_hrtimer()
1139 remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, in remove_hrtimer() argument
1142 u8 state = timer->state; in remove_hrtimer()
1148 * Remove the timer and force reprogramming when high in remove_hrtimer()
1149 * resolution mode is active and the timer is on the current in remove_hrtimer()
1150 * CPU. If we remove a timer on another CPU, reprogramming is in remove_hrtimer()
1155 debug_deactivate(timer); in remove_hrtimer()
1159 * If the timer is not restarted then reprogramming is in remove_hrtimer()
1160 * required if the timer is local. If it is local and about in remove_hrtimer()
1169 __remove_hrtimer(timer, base, state, reprogram); in remove_hrtimer()
1175 static inline ktime_t hrtimer_update_lowres(struct hrtimer *timer, ktime_t tim, in hrtimer_update_lowres() argument
1184 timer->is_rel = mode & HRTIMER_MODE_REL; in hrtimer_update_lowres()
1185 if (timer->is_rel) in hrtimer_update_lowres()
1216 static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, in __hrtimer_start_range_ns() argument
1224 * If the timer is on the local cpu base and is the first expiring in __hrtimer_start_range_ns()
1225 * timer then this might end up reprogramming the hardware twice in __hrtimer_start_range_ns()
1227 * reprogram on removal, keep the timer local to the current CPU in __hrtimer_start_range_ns()
1229 * it is the new first expiring timer again or not. in __hrtimer_start_range_ns()
1232 force_local &= base->cpu_base->next_timer == timer; in __hrtimer_start_range_ns()
1235 * Remove an active timer from the queue. In case it is not queued in __hrtimer_start_range_ns()
1239 * If it's on the current CPU and the first expiring timer, then in __hrtimer_start_range_ns()
1240 * skip reprogramming, keep the timer local and enforce in __hrtimer_start_range_ns()
1241 * reprogramming later if it was the first expiring timer. This in __hrtimer_start_range_ns()
1245 remove_hrtimer(timer, base, true, force_local); in __hrtimer_start_range_ns()
1250 tim = hrtimer_update_lowres(timer, tim, mode); in __hrtimer_start_range_ns()
1252 hrtimer_set_expires_range_ns(timer, tim, delta_ns); in __hrtimer_start_range_ns()
1254 /* Switch the timer base, if necessary: */ in __hrtimer_start_range_ns()
1256 new_base = switch_hrtimer_base(timer, base, in __hrtimer_start_range_ns()
1262 first = enqueue_hrtimer(timer, new_base, mode); in __hrtimer_start_range_ns()
1267 * Timer was forced to stay on the current CPU to avoid in __hrtimer_start_range_ns()
1269 * hardware by evaluating the new first expiring timer. in __hrtimer_start_range_ns()
1277 * @timer: the timer to be added
1279 * @delta_ns: "slack" range for the timer
1280 * @mode: timer mode: absolute (HRTIMER_MODE_ABS) or
1284 void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, in hrtimer_start_range_ns() argument
1296 WARN_ON_ONCE(!(mode & HRTIMER_MODE_SOFT) ^ !timer->is_soft); in hrtimer_start_range_ns()
1298 WARN_ON_ONCE(!(mode & HRTIMER_MODE_HARD) ^ !timer->is_hard); in hrtimer_start_range_ns()
1300 base = lock_hrtimer_base(timer, &flags); in hrtimer_start_range_ns()
1302 if (__hrtimer_start_range_ns(timer, tim, delta_ns, mode, base)) in hrtimer_start_range_ns()
1303 hrtimer_reprogram(timer, true); in hrtimer_start_range_ns()
1305 unlock_hrtimer_base(timer, &flags); in hrtimer_start_range_ns()
1310 * hrtimer_try_to_cancel - try to deactivate a timer
1311 * @timer: hrtimer to stop
1315 * * 0 when the timer was not active
1316 * * 1 when the timer was active
1317 * * -1 when the timer is currently executing the callback function and
1320 int hrtimer_try_to_cancel(struct hrtimer *timer) in hrtimer_try_to_cancel() argument
1327 * Check lockless first. If the timer is not active (neither in hrtimer_try_to_cancel()
1332 if (!hrtimer_active(timer)) in hrtimer_try_to_cancel()
1335 base = lock_hrtimer_base(timer, &flags); in hrtimer_try_to_cancel()
1337 if (!hrtimer_callback_running(timer)) in hrtimer_try_to_cancel()
1338 ret = remove_hrtimer(timer, base, false, false); in hrtimer_try_to_cancel()
1340 unlock_hrtimer_base(timer, &flags); in hrtimer_try_to_cancel()
1367 * the timer callback to finish. Drop expiry_lock and reacquire it. That
1383 * deletion of a timer failed because the timer callback function was
1387 * in the middle of a timer callback, then calling del_timer_sync() can
1390 * - If the caller is on a remote CPU then it has to spin wait for the timer
1393 * - If the caller originates from the task which preempted the timer
1394 * handler on the same CPU, then spin waiting for the timer handler to
1397 void hrtimer_cancel_wait_running(const struct hrtimer *timer) in hrtimer_cancel_wait_running() argument
1400 struct hrtimer_clock_base *base = READ_ONCE(timer->base); in hrtimer_cancel_wait_running()
1403 * Just relax if the timer expires in hard interrupt context or if in hrtimer_cancel_wait_running()
1406 if (!timer->is_soft || is_migration_base(base)) { in hrtimer_cancel_wait_running()
1413 * held by the softirq across the timer callback. Drop the lock in hrtimer_cancel_wait_running()
1414 * immediately so the softirq can expire the next timer. In theory in hrtimer_cancel_wait_running()
1415 * the timer could already be running again, but that's more than in hrtimer_cancel_wait_running()
1435 * hrtimer_cancel - cancel a timer and wait for the handler to finish.
1436 * @timer: the timer to be cancelled
1439 * 0 when the timer was not active
1440 * 1 when the timer was active
1442 int hrtimer_cancel(struct hrtimer *timer) in hrtimer_cancel() argument
1447 ret = hrtimer_try_to_cancel(timer); in hrtimer_cancel()
1450 hrtimer_cancel_wait_running(timer); in hrtimer_cancel()
1457 * __hrtimer_get_remaining - get remaining time for the timer
1458 * @timer: the timer to read
1461 ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust) in __hrtimer_get_remaining() argument
1466 lock_hrtimer_base(timer, &flags); in __hrtimer_get_remaining()
1468 rem = hrtimer_expires_remaining_adjusted(timer); in __hrtimer_get_remaining()
1470 rem = hrtimer_expires_remaining(timer); in __hrtimer_get_remaining()
1471 unlock_hrtimer_base(timer, &flags); in __hrtimer_get_remaining()
1481 * Returns the next expiry time or KTIME_MAX if no timer is pending.
1500 * hrtimer_next_event_without - time until next expiry event w/o one timer
1501 * @exclude: timer to exclude
1545 static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, in __hrtimer_init() argument
1561 memset(timer, 0, sizeof(struct hrtimer)); in __hrtimer_init()
1575 timer->is_soft = softtimer; in __hrtimer_init()
1576 timer->is_hard = !!(mode & HRTIMER_MODE_HARD); in __hrtimer_init()
1577 timer->base = &cpu_base->clock_base[base]; in __hrtimer_init()
1578 timerqueue_init(&timer->node); in __hrtimer_init()
1582 * hrtimer_init - initialize a timer to the given clock
1583 * @timer: the timer to be initialized
1593 void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, in hrtimer_init() argument
1596 debug_init(timer, clock_id, mode); in hrtimer_init()
1597 __hrtimer_init(timer, clock_id, mode); in hrtimer_init()
1602 * A timer is active, when it is enqueued into the rbtree or the
1608 bool hrtimer_active(const struct hrtimer *timer) in hrtimer_active() argument
1614 base = READ_ONCE(timer->base); in hrtimer_active()
1617 if (timer->state != HRTIMER_STATE_INACTIVE || in hrtimer_active()
1618 base->running == timer) in hrtimer_active()
1622 base != READ_ONCE(timer->base)); in hrtimer_active()
1632 * - queued: the timer is queued
1633 * - callback: the timer is being ran
1634 * - post: the timer is inactive or (re)queued
1636 * On the read side we ensure we observe timer->state and cpu_base->running
1638 * This includes timer->base changing because sequence numbers alone are
1648 struct hrtimer *timer, ktime_t *now, in __run_hrtimer() argument
1657 debug_deactivate(timer); in __run_hrtimer()
1658 base->running = timer; in __run_hrtimer()
1665 * timer->state == INACTIVE. in __run_hrtimer()
1669 __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, 0); in __run_hrtimer()
1670 fn = timer->function; in __run_hrtimer()
1674 * timer is restarted with a period then it becomes an absolute in __run_hrtimer()
1675 * timer. If its not restarted it does not matter. in __run_hrtimer()
1678 timer->is_rel = false; in __run_hrtimer()
1681 * The timer is marked as running in the CPU base, so it is in __run_hrtimer()
1686 trace_hrtimer_expire_entry(timer, now); in __run_hrtimer()
1687 expires_in_hardirq = lockdep_hrtimer_enter(timer); in __run_hrtimer()
1689 restart = fn(timer); in __run_hrtimer()
1692 trace_hrtimer_expire_exit(timer); in __run_hrtimer()
1701 * hrtimer_start_range_ns() can have popped in and enqueued the timer in __run_hrtimer()
1705 !(timer->state & HRTIMER_STATE_ENQUEUED)) in __run_hrtimer()
1706 enqueue_hrtimer(timer, base, HRTIMER_MODE_ABS); in __run_hrtimer()
1712 * hrtimer_active() cannot observe base->running.timer == NULL && in __run_hrtimer()
1713 * timer->state == INACTIVE. in __run_hrtimer()
1717 WARN_ON_ONCE(base->running != timer); in __run_hrtimer()
1734 struct hrtimer *timer; in __hrtimer_run_queues() local
1736 timer = container_of(node, struct hrtimer, node); in __hrtimer_run_queues()
1747 * are right-of a not yet expired timer, because that in __hrtimer_run_queues()
1748 * timer will have to trigger a wakeup anyway. in __hrtimer_run_queues()
1750 if (basenow < hrtimer_get_softexpires_tv64(timer)) in __hrtimer_run_queues()
1753 __run_hrtimer(cpu_base, base, timer, &basenow, flags); in __hrtimer_run_queues()
1782 * High resolution timer interrupt
1802 * held to prevent that a timer is enqueued in our queue via in hrtimer_interrupt()
1834 * The next timer was already expired due to: in hrtimer_interrupt()
1935 static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer) in hrtimer_wakeup() argument
1938 container_of(timer, struct hrtimer_sleeper, timer); in hrtimer_wakeup()
1949 * hrtimer_sleeper_start_expires - Start a hrtimer sleeper timer
1951 * @mode: timer mode abs/rel
1966 if (IS_ENABLED(CONFIG_PREEMPT_RT) && sl->timer.is_hard) in hrtimer_sleeper_start_expires()
1969 hrtimer_start_expires(&sl->timer, mode); in hrtimer_sleeper_start_expires()
2000 __hrtimer_init(&sl->timer, clock_id, mode); in __hrtimer_init_sleeper()
2001 sl->timer.function = hrtimer_wakeup; in __hrtimer_init_sleeper()
2009 * @mode: timer mode abs/rel
2014 debug_init(&sl->timer, clock_id, mode); in hrtimer_init_sleeper()
2050 hrtimer_cancel(&t->timer); in do_nanosleep()
2062 ktime_t rem = hrtimer_expires_remaining(&t->timer); in do_nanosleep()
2081 hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires); in hrtimer_nanosleep_restart()
2083 destroy_hrtimer_on_stack(&t.timer); in hrtimer_nanosleep_restart()
2100 hrtimer_set_expires_range_ns(&t.timer, rqtp, slack); in hrtimer_nanosleep()
2112 restart->nanosleep.clockid = t.timer.base->clockid; in hrtimer_nanosleep()
2113 restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer); in hrtimer_nanosleep()
2116 destroy_hrtimer_on_stack(&t.timer); in hrtimer_nanosleep()
2197 struct hrtimer *timer; in migrate_hrtimer_list() local
2201 timer = container_of(node, struct hrtimer, node); in migrate_hrtimer_list()
2202 BUG_ON(hrtimer_callback_running(timer)); in migrate_hrtimer_list()
2203 debug_deactivate(timer); in migrate_hrtimer_list()
2207 * timer could be seen as !active and just vanish away in migrate_hrtimer_list()
2210 __remove_hrtimer(timer, old_base, HRTIMER_STATE_ENQUEUED, 0); in migrate_hrtimer_list()
2211 timer->base = new_base; in migrate_hrtimer_list()
2214 * reprogram the event device in case the timer in migrate_hrtimer_list()
2220 enqueue_hrtimer(timer, new_base, HRTIMER_MODE_ABS); in migrate_hrtimer_list()
2248 * timer on this CPU. Update it. in hrtimers_cpu_dying()
2273 * @mode: timer mode
2274 * @clock_id: timer clock to be used
2307 hrtimer_set_expires_range_ns(&t.timer, *expires, delta); in schedule_hrtimeout_range_clock()
2313 hrtimer_cancel(&t.timer); in schedule_hrtimeout_range_clock()
2314 destroy_hrtimer_on_stack(&t.timer); in schedule_hrtimeout_range_clock()
2326 * @mode: timer mode
2336 * but may decide to fire the timer earlier, but no earlier than @expires.
2351 * Returns 0 when the timer has expired. If the task was woken before the
2352 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or
2366 * @mode: timer mode
2385 * Returns 0 when the timer has expired. If the task was woken before the
2386 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or