Lines Matching +full:timeout +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0
3 * Kernel internal schedule timeout and sleeping functions
12 #include "tick-internal.h"
25 struct process_timer *timeout = from_timer(timeout, t, timer); in process_timeout() local
27 wake_up_process(timeout->task); in process_timeout()
31 * schedule_timeout - sleep until timeout
32 * @timeout: timeout value in jiffies
34 * Make the current task sleep until @timeout jiffies have elapsed.
38 * %TASK_RUNNING - the scheduler is called, but the task does not sleep
42 * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
46 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is
53 * Specifying a @timeout value of %MAX_SCHEDULE_TIMEOUT will schedule
54 * the CPU away without a bound on the timeout. In this case the return
59 * to be non-negative.
61 signed long __sched schedule_timeout(signed long timeout) in schedule_timeout() argument
66 switch (timeout) { in schedule_timeout()
85 if (timeout < 0) { in schedule_timeout()
86 pr_err("%s: wrong timeout value %lx\n", __func__, timeout); in schedule_timeout()
93 expire = timeout + jiffies; in schedule_timeout()
105 timeout = expire - jiffies; in schedule_timeout()
108 return timeout < 0 ? 0 : timeout; in schedule_timeout()
118 * schedule_timeout_interruptible - sleep until timeout (interruptible)
119 * @timeout: timeout value in jiffies
123 * Task state is set to TASK_INTERRUPTIBLE before starting the timeout.
125 signed long __sched schedule_timeout_interruptible(signed long timeout) in schedule_timeout_interruptible() argument
128 return schedule_timeout(timeout); in schedule_timeout_interruptible()
133 * schedule_timeout_killable - sleep until timeout (killable)
134 * @timeout: timeout value in jiffies
138 * Task state is set to TASK_KILLABLE before starting the timeout.
140 signed long __sched schedule_timeout_killable(signed long timeout) in schedule_timeout_killable() argument
143 return schedule_timeout(timeout); in schedule_timeout_killable()
148 * schedule_timeout_uninterruptible - sleep until timeout (uninterruptible)
149 * @timeout: timeout value in jiffies
153 * Task state is set to TASK_UNINTERRUPTIBLE before starting the timeout.
155 signed long __sched schedule_timeout_uninterruptible(signed long timeout) in schedule_timeout_uninterruptible() argument
158 return schedule_timeout(timeout); in schedule_timeout_uninterruptible()
163 * schedule_timeout_idle - sleep until timeout (idle)
164 * @timeout: timeout value in jiffies
168 * Task state is set to TASK_IDLE before starting the timeout. It is similar to
172 signed long __sched schedule_timeout_idle(signed long timeout) in schedule_timeout_idle() argument
175 return schedule_timeout(timeout); in schedule_timeout_idle()
180 * schedule_hrtimeout_range_clock - sleep until timeout
181 * @expires: timeout value (ktime_t)
182 * @delta: slack in expires timeout (ktime_t)
195 * Optimize when a zero timeout value is given. It does not in schedule_hrtimeout_range_clock()
208 return -EINTR; in schedule_hrtimeout_range_clock()
223 return !t.task ? 0 : -EINTR; in schedule_hrtimeout_range_clock()
228 * schedule_hrtimeout_range - sleep until timeout
229 * @expires: timeout value (ktime_t)
230 * @delta: slack in expires timeout (ktime_t)
243 * You can set the task state as follows -
245 * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to
249 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is
258 * by an explicit wakeup, it returns -EINTR.
269 * schedule_hrtimeout - sleep until timeout
270 * @expires: timeout value (ktime_t)
283 * msleep - sleep safely even with waitqueue interruptions
303 * all sleep durations greater or equal 4ms will meet the constraints.
305 * all sleep durations greater or equal 8ms will meet the constraints.
307 * all sleep durations greater or equal 16ms will meet the constraints.
309 * all sleep durations greater or equal 32ms will meet the constraints.
315 unsigned long timeout = msecs_to_jiffies(msecs); in msleep() local
317 while (timeout) in msleep()
318 timeout = schedule_timeout_uninterruptible(timeout); in msleep()
323 * msleep_interruptible - sleep waiting for signals
336 unsigned long timeout = msecs_to_jiffies(msecs); in msleep_interruptible() local
338 while (timeout && !signal_pending(current)) in msleep_interruptible()
339 timeout = schedule_timeout_interruptible(timeout); in msleep_interruptible()
340 return jiffies_to_msecs(timeout); in msleep_interruptible()
345 * usleep_range_state - Sleep for an approximate time in a given state
358 * In non-atomic context where the exact wakeup time is flexible, use
360 * responsiveness by avoiding the CPU-hogging busy-wait of udelay().
365 u64 delta = (u64)(max - min) * NSEC_PER_USEC; in usleep_range_state()