Re: [PATCH v3 8/9] KVM-GST: adjust scheduler cpu power

From: Peter Zijlstra
Date: Thu Jun 30 2011 - 17:55:41 EST


On Wed, 2011-06-29 at 11:29 -0400, Glauber Costa wrote:

> @@ -2063,12 +2092,7 @@ static int irqtime_account_si_update(void)
>
> #define sched_clock_irqtime (0)
>
> -static void update_rq_clock_task(struct rq *rq, s64 delta)
> -{
> - rq->clock_task += delta;
> -}
> -
> -#endif /* CONFIG_IRQ_TIME_ACCOUNTING */

That relies on the compiler realizing that irq_delta and steal will
never be used in the below function:

> 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;
>
> /*
> @@ -2023,12 +2034,30 @@ 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
> + if (static_branch((&paravirt_steal_rq_enabled))) {
> + int is_idle;
> + u64 st;
> +
> + is_idle = ((rq->curr != rq->idle) ||
> + irq_count() != HARDIRQ_OFFSET);
> +
> + __touch_steal_time(is_idle, delta, &st);
> +
> + steal = st * TICK_NSEC;
> +
> + delta -= steal;
> + }
> +#endif
> +
> rq->clock_task += delta;
>
> + if ((irq_delta + steal) && sched_feat(NONTASK_POWER))
> + sched_rt_avg_update(rq, irq_delta + steal);
> }

And thus trim the last bit as if(0) and DCE. Did you verify that the
compiler does indeed do that for !PARAVIRT !IRQ_TIME_ACCOUNTING ?
--
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/