?????????—????????????????????????—?????????????????????????????????????????????????????????????????????????????????á????????????????????????У??????????????????????????????????????????????????????????????????????????????????д?????????????
?????????????????????????????????????????ū???linux2.6?????????????????????????????
??????start_kernel(void)-->init_timers(void)
void __init init_timers(void)
{
int err = timer_cpu_notify(&timers_nb?? (unsigned long)CPU_UP_PREPARE??
(void *)(long)smp_processor_id());
init_timer_stats();
BUG_ON(err == NOTIFY_BAD);
register_cpu_notifier(&timers_nb);
open_softirq(TIMER_SOFTIRQ?? run_timer_softirq);
}
??timer_cpu_notify(&timers_nb??(unsigned long)CPU_UP_PREPARE??
(void*)(long)smp_processor_id());
?????????
????init_timers_cpu(cpu) //???????cpu?е?timers
?????????????????????
spin_lock_init(&base->lock);
for (j = 0; j < TVN_SIZE; j++) {
INIT_LIST_HEAD(base->tv5.vec + j);
INIT_LIST_HEAD(base->tv4.vec + j);
INIT_LIST_HEAD(base->tv3.vec + j);
INIT_LIST_HEAD(base->tv2.vec + j);
}
for (j = 0; j < TVR_SIZE; j++)
INIT_LIST_HEAD(base->tv1.vec + j);
base->timer_jiffies = jiffies;
base->next_timer = base->timer_jiffies;
??????δ??????????base??base????????structtvec_base *base;
???????tvec_base????????????????????????cpu??????????????????cpu?д??????????????????????????????????????cpu??????????????????
struct tvec_base {
spinlock_t lock;
struct timer_list *running_timer;
unsigned long timer_jiffies;
unsigned long next_timer;
struct tvec_root tv1;
struct tvec tv2;
struct tvec tv3;
struct tvec tv4;
struct tvec tv5;
} ____cacheline_aligned;