linux kernel timer expire处理机制

注册tick event handler为tick_handle_periodic,在每个系统tick到来时将回调此tick event handler:

clockevents_register_device
tick_check_new_device
tick_setup_device
tick_setup_periodic
tick_set_periodic_handler
static inline void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
{
dev->event_handler = tick_handle_periodic;
}

每个tick到来回去处理timer部分的逻辑,检查timer是否expire,如果expire,执行timer回调

tick_handle_periodic
tick_periodic
update_process_times
run_local_timers

reference:

Linux时间子系统之(十二):periodic tick

http://www.wowotech.net/timer_subsystem/periodic-tick.html

Linux时间子系统之定时器层(Timer)

https://blog.csdn.net/Roland_Sun/article/details/105775145

原文地址:https://www.cnblogs.com/aspirs/p/14798511.html