Re: [PATCH v4 14/15] Remove the ext server BW before changing tasks to FAIR
From: Joel Fernandes
Date: Wed Jun 18 2025 - 09:21:28 EST
On 6/17/2025 4:42 PM, Andrea Righi wrote:
>> +
>> + /*
>> + * We are unloading the sched_ext scheduler, we do not need its
>> + * DL server bandwidth anymore, remove it for all CPUs. Whenever
>> + * the first SCX task is enqueued (when scx is re-loaded), its DL
>> + * server bandwidth will be re-initialized.
>> + */
>> + rq_lock_irqsave(rq, &rf);
>> + update_rq_clock(rq);
>> + if (dl_server_active(&rq->ext_server))
>> + dl_server_stop(&rq->ext_server);
>> + dl_server_remove_params(&rq->ext_server);
>> + rq_unlock_irqrestore(rq, &rf);
>> + }
>> +
>> +
>> scx_task_iter_start(&sti);
>> while ((p = scx_task_iter_next_locked(&sti))) {
>> const struct sched_class *old_class = p->sched_class;
>> @@ -4985,26 +5010,12 @@ static void scx_disable_workfn(struct kthread_work *work)
>>
>> for_each_possible_cpu(cpu) {
>> struct rq *rq = cpu_rq(cpu);
>> - struct rq_flags rf;
>>
>> /*
>> * Invalidate all the rq clocks to prevent getting outdated
>> * rq clocks from a previous scx scheduler.
>> */
>> scx_rq_clock_invalidate(rq);
>> -
>> - /*
>> - * We are unloading the sched_ext scheduler, we do not need its
>> - * DL server bandwidth anymore, remove it for all CPUs. Whenever
>> - * the first SCX task is enqueued (when scx is re-loaded), its DL
>> - * server bandwidth will be re-initialized.
>> - */
>> - rq_lock_irqsave(rq, &rf);
>> - update_rq_clock(rq);
>> - if (dl_server_active(&rq->ext_server))
>> - dl_server_stop(&rq->ext_server);
>> - dl_server_remove_params(&rq->ext_server);
>> - rq_unlock_irqrestore(rq, &rf);
>> }
>
> We should probably remove this for_each_possible_cpu() completely.
Ah right, we only need to call scx_rq_clock_invalidate(rq); per its comment:
+ /*
+ * Invalidate all the rq clocks to prevent getting outdated
+ * rq clocks from a previous scx scheduler.
+ */
So I'll get rid of it and run some tests, thanks!
- Joel