Re: [PATCH 1/7] sched: Update rq clock on nohz CPU before migratingtasks

From: Ingo Molnar
Date: Mon Apr 08 2013 - 07:49:02 EST



* Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:

> @@ -1115,6 +1116,12 @@ static inline void dec_nr_running(struct rq *rq)
>
> extern void update_rq_clock(struct rq *rq);
>
> +static inline void update_nohz_rq_clock(struct rq *rq)
> +{
> + if (tick_nohz_extended_cpu(cpu_of(rq)))
> + update_rq_clock(rq);
> +}

A minor comment: instead of implicitly knowing that full nohz CPUs mean a stale
rq_clock, how about adding this information to the rq-> itself?

Something like introducing rq->clock_valid, initializing it to 1, and setting it
to 0 when a CPU stops the tick.

(This would also allow the debug detection of sched_clock() use of stale values.)

We already have a similar flag: rq->skip_clock_update. I'd suggest to introduce a
'struct sched_clock' helper structure and add the flags and scheduler clock fields
as:

rq->clock -> rq->clock.cpu
rq->clock_task -> rq->clock.task
rq->clock_valid -> rq->clock.valid
rq->clock_skip_uipdate -> rq->clock.skip_update
rq->hrtick_timer -> rq->clock.hrtick_timer

rq->prev_irq_time -> rq->clock.prev_irq_time
rq->prev_steal_time -> rq->clock.prev_steal_time
rq->prev_steal_time_rq -> rq->clock.prev_steal_time_rq

Thanks,

ngo
--
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/