时间管理—— 5 seconds(三)

如果已经切换到高精度时钟,且支持 动态时钟&NO_HZ===>

现在切换到X86 & 3.14.25

1.tick_period


/*                                                                                                                               
 * We rearm the timer until we get disabled by the idle code.
 * Called with interrupts disabled.
 */
static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
{
    struct tick_sched *ts = container_of(timer, struct tick_sched, sched_timer);
    struct pt_regs *regs = get_irq_regs();
    ktime_t now = ktime_get();

    tick_sched_do_timer(now);

+--  4 lines: Do not call, when we are not in irq context and have-------------------------------
    if (regs)
        tick_sched_handle(ts, regs);

    hrtimer_forward(timer, now, tick_period); //raise TIMER_SOFTIRQ

    return HRTIMER_RESTART;
}  

/**
 * tick_setup_sched_timer - setup the tick emulation timer
 */
void tick_setup_sched_timer(void)
{
    struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
+--  5 lines: ktime_t now = ktime_get();------------------------------------------------------
hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); ts->sched_timer.function = tick_sched_timer; //tick period转到hr timer上 +-- 21 lines: Get the next period (per cpu) ----------------------------------------------- +-- 6 lines: #ifdef CONFIG_NO_HZ_COMMON------------------------------------------------- }

 

 2. 其它hrtimer

 

posted on 2014-12-31 23:15  阿加  阅读(355)  评论(0)    收藏  举报

导航