Re: [PATCH v3 5/6] KVM-GST: adjust scheduler cpu power
From: Peter Zijlstra
Date: Fri Feb 11 2011 - 14:04:47 EST
On Fri, 2011-02-11 at 13:19 -0500, Glauber Costa wrote:
> static void update_rq_clock_task(struct rq *rq, s64 delta)
> {
> + s64 irq_delta = 0, steal = 0;
>
> +#ifdef CONFIG_IRQ_TIME_ACCOUNTING
> irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
>
> /*
> @@ -1926,20 +1932,24 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
>
> rq->prev_irq_time += irq_delta;
> delta -= irq_delta;
> +#endif
> +#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
>
> + steal = steal_time_clock(cpu_of(rq)) - rq->prev_steal_time;
>
> + if (steal > delta)
> + steal = delta;
> +
> + rq->prev_steal_time += steal;
> +
> + delta -= steal;
> +#endif
>
> rq->clock_task += delta;
>
> + if ((irq_delta + steal) && sched_feat(NONTASK_POWER))
> + sched_rt_avg_update(rq, irq_delta + steal);
> +}
I think we should make both these conditional, like:
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
if (sched_clock_irqtime) {
/* ... magic ... */
}
#endif
#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
if (sched_paravirt_time) {
/* ... magic ... */
}
#endif
Once the jump-label stuff gets a bit better we could use the if
(static_branch()) magic to avoid pretty much all cost.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/