@@ -696,15 +696,21 @@ u64 avg_vruntime(struct cfs_rq *cfs_rq)
696
696
*
697
697
* XXX could add max_slice to the augmented data to track this.
698
698
*/
699
- static void update_entity_lag ( struct cfs_rq * cfs_rq , struct sched_entity * se )
699
+ static s64 entity_lag ( u64 avruntime , struct sched_entity * se )
700
700
{
701
- s64 lag , limit ;
701
+ s64 vlag , limit ;
702
+
703
+ vlag = avruntime - se -> vruntime ;
704
+ limit = calc_delta_fair (max_t (u64 , 2 * se -> slice , TICK_NSEC ), se );
705
+
706
+ return clamp (vlag , - limit , limit );
707
+ }
702
708
709
+ static void update_entity_lag (struct cfs_rq * cfs_rq , struct sched_entity * se )
710
+ {
703
711
SCHED_WARN_ON (!se -> on_rq );
704
- lag = avg_vruntime (cfs_rq ) - se -> vruntime ;
705
712
706
- limit = calc_delta_fair (max_t (u64 , 2 * se -> slice , TICK_NSEC ), se );
707
- se -> vlag = clamp (lag , - limit , limit );
713
+ se -> vlag = entity_lag (avg_vruntime (cfs_rq ), se );
708
714
}
709
715
710
716
/*
@@ -3760,7 +3766,7 @@ static void reweight_eevdf(struct sched_entity *se, u64 avruntime,
3760
3766
* = V - vl'
3761
3767
*/
3762
3768
if (avruntime != se -> vruntime ) {
3763
- vlag = ( s64 )( avruntime - se -> vruntime );
3769
+ vlag = entity_lag ( avruntime , se );
3764
3770
vlag = div_s64 (vlag * old_weight , weight );
3765
3771
se -> vruntime = avruntime - vlag ;
3766
3772
}
0 commit comments