Re: [patch 06/16] sched: add a timer to handle CFS bandwidth refresh

Hidetoshi Seto
2011-06-22T09:38:55Z

(2011/06/21 16:16), Paul Turner wrote:
> This patch adds a per-task_group timer which handles the refresh of the global
> CFS bandwidth pool.
>
> Since the RT pool is using a similar timer there's some small refactoring to
> share this support.
>
> Signed-off-by: Paul Turner <pjt@google.com>
> Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
>
> ---
(snip)
> @@ -413,8 +444,26 @@ static void init_cfs_rq_runtime(struct c
> cfs_rq->runtime_enabled = 0;
> }
>
> +/* requires cfs_b->lock */
> +static void __start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
> +{
> + /*
> + * Handle the extremely unlikely case of trying to start the period
> + * timer, while that timer is in the tear-down path from having
> + * decided to no longer run. In this case we must wait for the
> + * (tail of the) callback to terminate so that we can re-enqueue it.
> + */
> + if (unlikely(hrtimer_active(&cfs_b->period_timer)))
> + hrtimer_cancel(&cfs_b->period_timer);
> +
> + cfs_b->timer_active = 1;
> + start_bandwidth_timer(&cfs_b->period_timer, cfs_b->period);
> +}
> +

Nice trick :-)

(Again,)
Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>

Thanks,
H.Seto