According to the discussion in [1], fix a calculation bug in
reweight_entity().
[1] https://lore.kernel.org/all/[email protected]/
Tianchen Ding (2):
sched/eevdf: Always update V if se->on_rq when reweighting
sched/eevdf: Fix miscalculation in reweight_entity() when se is not
curr
kernel/sched/fair.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--
2.39.3
reweight_eevdf() needs the latest V to do accurate calculation for new
ve and vd. So update V unconditionally when se is runnable.
Suggested-by: Abel Wu <[email protected]>
Signed-off-by: Tianchen Ding <[email protected]>
---
kernel/sched/fair.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 03be0d1330a6..5551ce2af73e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3790,9 +3790,8 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
if (se->on_rq) {
/* commit outstanding execution time */
- if (curr)
- update_curr(cfs_rq);
- else
+ update_curr(cfs_rq);
+ if (!curr)
__dequeue_entity(cfs_rq, se);
update_load_sub(&cfs_rq->load, se->load.weight);
}
--
2.39.3
On 3/4/24 11:00 AM, Tianchen Ding Wrote:
> reweight_eevdf() needs the latest V to do accurate calculation for new
> ve and vd. So update V unconditionally when se is runnable.
As this should come along with commit eab03c23c2a1, I think it would
be better add a Fixes tag?
>
> Suggested-by: Abel Wu <[email protected]>
> Signed-off-by: Tianchen Ding <[email protected]>
> ---
> kernel/sched/fair.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 03be0d1330a6..5551ce2af73e 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3790,9 +3790,8 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
>
> if (se->on_rq) {
> /* commit outstanding execution time */
> - if (curr)
> - update_curr(cfs_rq);
> - else
> + update_curr(cfs_rq);
> + if (!curr)
> __dequeue_entity(cfs_rq, se);
> update_load_sub(&cfs_rq->load, se->load.weight);
> }
On 2024/3/4 20:06, Abel Wu wrote:
> On 3/4/24 11:00 AM, Tianchen Ding Wrote:
>> reweight_eevdf() needs the latest V to do accurate calculation for new
>> ve and vd. So update V unconditionally when se is runnable.
>
> As this should come along with commit eab03c23c2a1, I think it would
> be better add a Fixes tag?
>
I'm not sure. In fact avg_vruntime_sub() in reweight_entity() was first
introduced by af4cf40470c2, and at that time the algorithm about reweight was
not completed...
On 3/5/24 10:13 AM, Tianchen Ding Wrote:
> On 2024/3/4 20:06, Abel Wu wrote:
>> On 3/4/24 11:00 AM, Tianchen Ding Wrote:
>>> reweight_eevdf() needs the latest V to do accurate calculation for new
>>> ve and vd. So update V unconditionally when se is runnable.
>>
>> As this should come along with commit eab03c23c2a1, I think it would
>> be better add a Fixes tag?
>>
>
> I'm not sure. In fact avg_vruntime_sub() in reweight_entity() was first introduced by af4cf40470c2, and at that time the algorithm about reweight was not completed...
>
It is because before commit eab03c23c2a1, reweight didn't rely on V.