Messages in this thread | | | Date | Mon, 8 Apr 2013 13:48:51 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH 1/7] sched: Update rq clock on nohz CPU before migrating tasks |
| |
* Frederic Weisbecker <fweisbec@gmail.com> 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
| |