Re: [PATCH v2 2/2] sched/fair: avoid recalculating curr status in place_entity() and requeue_delayed_entity()
From: Kayra Cizmeci
Date: Fri Sep 11 2026 - 09:15:10 EST
Hello Vincent,
>> @@ -6256,10 +6256,17 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
>> * vl_i = (W + w_i)*vl'_i / W
>> */
>> load = cfs_rq->sum_weight;
>> - if (curr && curr->on_rq)
>> - load += avg_vruntime_weight(cfs_rq, curr->h_load.weight);
>> + if (curr && (curr->on_rq || is_curr)) {
>> + curr_weight = avg_vruntime_weight(cfs_rq, curr->h_load.weight);
>> + if (curr->on_rq)
>> + load += curr_weight;
>> + }
>> +
>> + if (is_curr)
>> + weight = curr_weight;
>> + else
>> + weight = avg_vruntime_weight(cfs_rq, se->h_load.weight);
> This makes the code less readable and I don't think it gives any
> measurable benefit.
Well, yeah. 1 avg_vruntime_weight() less or much is not measurable
in any means.
The main thing I wanted was to handle curr == se case
on here.
Maybe we could remove this is_curr bool and look se == curr
in function, and remove this curr weight and let the curr use weight
instead. So, the curr_weightnbecomes weight, we could be done
with the if (is_curr) block since we don't need to set weight to curr_weight.
Well if you think handling curr == se separately is wrong, then I'll drop the patch.
Please let me know what you're thinking :-).
Thanks,
Kayra :_: