Re: [PATCH 2/7] sched: Update rq clock on nohz CPU before settingfair group shares

From: Peter Zijlstra
Date: Tue Apr 09 2013 - 05:26:46 EST


On Sat, 2013-04-06 at 18:45 +0200, Frederic Weisbecker wrote:
> Because we may update the execution time (sched_group_set_shares()->
> update_cfs_shares()->reweight_entity()->update_curr()) before
> reweighting the entity after updating the group shares and this
> requires
> an uptodate version of the runqueue clock. Let's update it on the
> target
> CPU if it runs tickless because scheduler_tick() is not there to
> maintain
> it.

Same as the last comment, we should never rely on the tick to update
->clock except for the work done by the tick itself.

Therefore you seem to have found another missing clock update.

The problem seems to be that we haven't been able to come up with a
sane debug framework for the ->clock updates. But we should have at
least one (and preferably no more) update_sched_clock() calls per
scheduler entry point.

> ---
> kernel/sched/fair.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 539760e..6d35f8a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6060,6 +6060,11 @@ int sched_group_set_shares(struct task_group
> *tg, unsigned long shares)
> se = tg->se[i];
> /* Propagate contribution to hierarchy */
> raw_spin_lock_irqsave(&rq->lock, flags);
> + /*
> + * We may call update_curr() which needs an up-to-date
> + * version of rq clock if the CPU runs tickless.
> + */
> + update_nohz_rq_clock(rq);
> for_each_sched_entity(se)
> update_cfs_shares(group_cfs_rq(se));
> raw_spin_unlock_irqrestore(&rq->lock, flags);


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