Linux Kernel
3.7.1
|
#include <linux/list.h>
#include <linux/ktime.h>
#include <linux/stddef.h>
#include <linux/debugobjects.h>
#include <linux/stringify.h>
Go to the source code of this file.
Data Structures | |
struct | timer_list |
Variables | |
struct tvec_base | boot_tvec_bases |
#define __init_timer | ( | _timer, | |
_flags | |||
) | init_timer_key((_timer), (_flags), NULL, NULL) |
#define __setup_timer | ( | _timer, | |
_fn, | |||
_data, | |||
_flags | |||
) |
#define __setup_timer_on_stack | ( | _timer, | |
_fn, | |||
_data, | |||
_flags | |||
) |
#define __TIMER_INITIALIZER | ( | _function, | |
_expires, | |||
_data, | |||
_flags | |||
) |
#define DEFINE_TIMER | ( | _name, | |
_function, | |||
_expires, | |||
_data | |||
) |
#define del_singleshot_timer_sync | ( | t | ) | del_timer_sync(t) |
#define init_timer | ( | timer | ) | __init_timer((timer), 0) |
#define init_timer_deferrable | ( | timer | ) | __init_timer((timer), TIMER_DEFERRABLE) |
#define init_timer_on_stack | ( | timer | ) | __init_timer_on_stack((timer), 0) |
#define setup_deferrable_timer_on_stack | ( | timer, | |
fn, | |||
data | |||
) | __setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE) |
#define TIMER_DEFERRED_INITIALIZER | ( | _function, | |
_expires, | |||
_data | |||
) | __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE) |
#define TIMER_INITIALIZER | ( | _function, | |
_expires, | |||
_data | |||
) | __TIMER_INITIALIZER((_function), (_expires), (_data), 0) |
__round_jiffies - function to round jiffies to a full second : the time in (absolute) jiffies that should be rounded : the processor number on which the timeout will happen
__round_jiffies() rounds an absolute time in the future (in jiffies) up or down to (approximately) full seconds. This is useful for timers for which the exact time they fire does not matter too much, as long as they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
The exact rounding is skewed for each processor to avoid all processors firing at the exact same time, which could lead to lock contention or spurious cache line bouncing.
__round_jiffies_relative - function to round jiffies to a full second : the time in (relative) jiffies that should be rounded : the processor number on which the timeout will happen
__round_jiffies_relative() rounds a time delta in the future (in jiffies) up or down to (approximately) full seconds. This is useful for timers for which the exact time they fire does not matter too much, as long as they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
The exact rounding is skewed for each processor to avoid all processors firing at the exact same time, which could lead to lock contention or spurious cache line bouncing.
__round_jiffies_up - function to round jiffies up to a full second : the time in (absolute) jiffies that should be rounded : the processor number on which the timeout will happen
This is the same as __round_jiffies() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early.
__round_jiffies_up_relative - function to round jiffies up to a full second : the time in (relative) jiffies that should be rounded : the processor number on which the timeout will happen
This is the same as __round_jiffies_relative() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early.
void add_timer | ( | struct timer_list * | timer | ) |
add_timer - start a timer : the timer to be added
The kernel will do a ->function(->data) callback from the timer interrupt at the ->expires point in the future. The current time is 'jiffies'.
The timer's ->expires, ->function (and if the handler uses it, ->data) fields must be set prior calling this function.
Timers with an ->expires field in the past will be executed in the next timer tick.
void add_timer_on | ( | struct timer_list * | timer, |
int | cpu | ||
) |
int del_timer | ( | struct timer_list * | timer | ) |
del_timer - deactive a timer. : the timer to be deactivated
del_timer() deactivates a timer - this works on both active and inactive timers.
The function returns whether it has deactivated a pending timer or not. (ie. del_timer() of an inactive timer returns 0, del_timer() of an active timer returns 1.)
void init_timer_key | ( | struct timer_list * | timer, |
unsigned int | flags, | ||
const char * | name, | ||
struct lock_class_key * | key | ||
) |
enum hrtimer_restart it_real_fn | ( | struct hrtimer * | ) |
int mod_timer | ( | struct timer_list * | timer, |
unsigned long | expires | ||
) |
mod_timer - modify a timer's timeout : the timer to be modified : new timeout in jiffies
mod_timer() is a more efficient way to update the expire field of an active timer (if the timer is inactive it will be activated)
mod_timer(timer, expires) is equivalent to:
del_timer(timer); timer->expires = expires; add_timer(timer);
Note that if there are multiple unserialized concurrent users of the same timer, then mod_timer() is the only safe way to modify the timeout, since add_timer() cannot modify an already running timer.
The function returns whether it has modified a pending timer or not. (ie. mod_timer() of an inactive timer returns 0, mod_timer() of an active timer returns 1.)
int mod_timer_pending | ( | struct timer_list * | timer, |
unsigned long | expires | ||
) |
mod_timer_pending - modify a pending timer's timeout : the pending timer to be modified : new timeout in jiffies
mod_timer_pending() is the same for pending timers as mod_timer(), but will not re-activate and modify already deleted timers.
It is useful for unserialized use of timers.
int mod_timer_pinned | ( | struct timer_list * | timer, |
unsigned long | expires | ||
) |
mod_timer_pinned - modify a timer's timeout : the timer to be modified : new timeout in jiffies
mod_timer_pinned() is a way to update the expire field of an active timer (if the timer is inactive it will be activated) and to ensure that the timer is scheduled on the current CPU.
Note that this does not prevent the timer from being migrated when the current CPU goes offline. If this is a problem for you, use CPU-hotplug notifiers to handle it correctly, for example, cancelling the timer when the corresponding CPU goes offline.
mod_timer_pinned(timer, expires) is equivalent to:
del_timer(timer); timer->expires = expires; add_timer(timer);
round_jiffies - function to round jiffies to a full second : the time in (absolute) jiffies that should be rounded
round_jiffies() rounds an absolute time in the future (in jiffies) up or down to (approximately) full seconds. This is useful for timers for which the exact time they fire does not matter too much, as long as they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
round_jiffies_relative - function to round jiffies to a full second : the time in (relative) jiffies that should be rounded
round_jiffies_relative() rounds a time delta in the future (in jiffies) up or down to (approximately) full seconds. This is useful for timers for which the exact time they fire does not matter too much, as long as they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
round_jiffies_up - function to round jiffies up to a full second : the time in (absolute) jiffies that should be rounded
This is the same as round_jiffies() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early.
round_jiffies_up_relative - function to round jiffies up to a full second : the time in (relative) jiffies that should be rounded
This is the same as round_jiffies_relative() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early.
void set_timer_slack | ( | struct timer_list * | timer, |
int | slack_hz | ||
) |
set_timer_slack - set the allowed slack for a timer : the timer to be modified : the amount of time (in jiffies) allowed for rounding
Set the amount of time, in jiffies, that a certain timer has in terms of slack. By setting this value, the timer subsystem will schedule the actual timer somewhere between the time mod_timer() asks for, and that time plus the slack.
By setting the slack to -1, a percentage of the delay is used instead.
int try_to_del_timer_sync | ( | struct timer_list * | timer | ) |