Re: [PATCH v5 1/3] sched/fair: Introduce the burstable CFS controller

From: Benjamin Segall
Date: Tue May 25 2021 - 17:25:50 EST


Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:

> On Mon, May 24, 2021 at 08:42:03PM +0800, changhuaixin wrote:
>
>> >> static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
>> >> @@ -4651,6 +4666,9 @@ static int __assign_cfs_rq_runtime(struct cfs_bandwidth *cfs_b,
>> >> if (cfs_b->quota == RUNTIME_INF)
>> >> amount = min_amount;
>> >> else {
>> >> + if (!cfs_b->period_active)
>> >> + __refill_cfs_bandwidth_runtime(cfs_b);
>> >
>> > Why this call?
>>
>> As the cfs bandwidth timer stops on idle with runtime unfilled, refill runtime when it restarts to make
>> use of the underrun when period timer stops. Another way to do this might be:
>>
>> throttled = !list_empty(&cfs_b->throttled_cfs_rq);
>> cfs_b->nr_periods += overrun;
>>
>> + __refill_cfs_bandwidth_runtime(cfs_b);
>> +
>> /*
>> * idle depends on !throttled (for the case of a large deficit), and if
>> * we're going inactive then everything else can be deferred
>> */
>> if (cfs_b->idle && !throttled)
>> goto out_deactivate;
>>
>> - __refill_cfs_bandwidth_runtime(cfs_b);
>> -
>> if (!throttled) {
>>
>
> Ben, do you have a preference?


I think I prefer the latter, possibly with a
/* Refill extra burst quota even if cfs_b->idle */