@@ -741,9 +741,7 @@ void init_entity_runnable_average(struct sched_entity *se)
741741 * nothing has been attached to the task group yet.
742742 */
743743 if (entity_is_task (se ))
744- sa -> runnable_load_avg = sa -> load_avg = scale_load_down (se -> load .weight );
745-
746- se -> runnable_weight = se -> load .weight ;
744+ sa -> load_avg = scale_load_down (se -> load .weight );
747745
748746 /* when this task enqueue'ed, it will contribute to its cfs_rq's load_avg */
749747}
@@ -2898,25 +2896,6 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
28982896} while (0)
28992897
29002898#ifdef CONFIG_SMP
2901- static inline void
2902- enqueue_runnable_load_avg (struct cfs_rq * cfs_rq , struct sched_entity * se )
2903- {
2904- cfs_rq -> runnable_weight += se -> runnable_weight ;
2905-
2906- cfs_rq -> avg .runnable_load_avg += se -> avg .runnable_load_avg ;
2907- cfs_rq -> avg .runnable_load_sum += se_runnable (se ) * se -> avg .runnable_load_sum ;
2908- }
2909-
2910- static inline void
2911- dequeue_runnable_load_avg (struct cfs_rq * cfs_rq , struct sched_entity * se )
2912- {
2913- cfs_rq -> runnable_weight -= se -> runnable_weight ;
2914-
2915- sub_positive (& cfs_rq -> avg .runnable_load_avg , se -> avg .runnable_load_avg );
2916- sub_positive (& cfs_rq -> avg .runnable_load_sum ,
2917- se_runnable (se ) * se -> avg .runnable_load_sum );
2918- }
2919-
29202899static inline void
29212900enqueue_load_avg (struct cfs_rq * cfs_rq , struct sched_entity * se )
29222901{
@@ -2932,45 +2911,36 @@ dequeue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se)
29322911}
29332912#else
29342913static inline void
2935- enqueue_runnable_load_avg (struct cfs_rq * cfs_rq , struct sched_entity * se ) { }
2936- static inline void
2937- dequeue_runnable_load_avg (struct cfs_rq * cfs_rq , struct sched_entity * se ) { }
2938- static inline void
29392914enqueue_load_avg (struct cfs_rq * cfs_rq , struct sched_entity * se ) { }
29402915static inline void
29412916dequeue_load_avg (struct cfs_rq * cfs_rq , struct sched_entity * se ) { }
29422917#endif
29432918
29442919static void reweight_entity (struct cfs_rq * cfs_rq , struct sched_entity * se ,
2945- unsigned long weight , unsigned long runnable )
2920+ unsigned long weight )
29462921{
29472922 if (se -> on_rq ) {
29482923 /* commit outstanding execution time */
29492924 if (cfs_rq -> curr == se )
29502925 update_curr (cfs_rq );
29512926 account_entity_dequeue (cfs_rq , se );
2952- dequeue_runnable_load_avg (cfs_rq , se );
29532927 }
29542928 dequeue_load_avg (cfs_rq , se );
29552929
2956- se -> runnable_weight = runnable ;
29572930 update_load_set (& se -> load , weight );
29582931
29592932#ifdef CONFIG_SMP
29602933 do {
29612934 u32 divider = LOAD_AVG_MAX - 1024 + se -> avg .period_contrib ;
29622935
29632936 se -> avg .load_avg = div_u64 (se_weight (se ) * se -> avg .load_sum , divider );
2964- se -> avg .runnable_load_avg =
2965- div_u64 (se_runnable (se ) * se -> avg .runnable_load_sum , divider );
29662937 } while (0 );
29672938#endif
29682939
29692940 enqueue_load_avg (cfs_rq , se );
2970- if (se -> on_rq ) {
2941+ if (se -> on_rq )
29712942 account_entity_enqueue (cfs_rq , se );
2972- enqueue_runnable_load_avg (cfs_rq , se );
2973- }
2943+
29742944}
29752945
29762946void reweight_task (struct task_struct * p , int prio )
@@ -2980,7 +2950,7 @@ void reweight_task(struct task_struct *p, int prio)
29802950 struct load_weight * load = & se -> load ;
29812951 unsigned long weight = scale_load (sched_prio_to_weight [prio ]);
29822952
2983- reweight_entity (cfs_rq , se , weight , weight );
2953+ reweight_entity (cfs_rq , se , weight );
29842954 load -> inv_weight = sched_prio_to_wmult [prio ];
29852955}
29862956
@@ -3092,50 +3062,6 @@ static long calc_group_shares(struct cfs_rq *cfs_rq)
30923062 */
30933063 return clamp_t (long , shares , MIN_SHARES , tg_shares );
30943064}
3095-
3096- /*
3097- * This calculates the effective runnable weight for a group entity based on
3098- * the group entity weight calculated above.
3099- *
3100- * Because of the above approximation (2), our group entity weight is
3101- * an load_avg based ratio (3). This means that it includes blocked load and
3102- * does not represent the runnable weight.
3103- *
3104- * Approximate the group entity's runnable weight per ratio from the group
3105- * runqueue:
3106- *
3107- * grq->avg.runnable_load_avg
3108- * ge->runnable_weight = ge->load.weight * -------------------------- (7)
3109- * grq->avg.load_avg
3110- *
3111- * However, analogous to above, since the avg numbers are slow, this leads to
3112- * transients in the from-idle case. Instead we use:
3113- *
3114- * ge->runnable_weight = ge->load.weight *
3115- *
3116- * max(grq->avg.runnable_load_avg, grq->runnable_weight)
3117- * ----------------------------------------------------- (8)
3118- * max(grq->avg.load_avg, grq->load.weight)
3119- *
3120- * Where these max() serve both to use the 'instant' values to fix the slow
3121- * from-idle and avoid the /0 on to-idle, similar to (6).
3122- */
3123- static long calc_group_runnable (struct cfs_rq * cfs_rq , long shares )
3124- {
3125- long runnable , load_avg ;
3126-
3127- load_avg = max (cfs_rq -> avg .load_avg ,
3128- scale_load_down (cfs_rq -> load .weight ));
3129-
3130- runnable = max (cfs_rq -> avg .runnable_load_avg ,
3131- scale_load_down (cfs_rq -> runnable_weight ));
3132-
3133- runnable *= shares ;
3134- if (load_avg )
3135- runnable /= load_avg ;
3136-
3137- return clamp_t (long , runnable , MIN_SHARES , shares );
3138- }
31393065#endif /* CONFIG_SMP */
31403066
31413067static inline int throttled_hierarchy (struct cfs_rq * cfs_rq );
@@ -3147,7 +3073,7 @@ static inline int throttled_hierarchy(struct cfs_rq *cfs_rq);
31473073static void update_cfs_group (struct sched_entity * se )
31483074{
31493075 struct cfs_rq * gcfs_rq = group_cfs_rq (se );
3150- long shares , runnable ;
3076+ long shares ;
31513077
31523078 if (!gcfs_rq )
31533079 return ;
@@ -3156,16 +3082,15 @@ static void update_cfs_group(struct sched_entity *se)
31563082 return ;
31573083
31583084#ifndef CONFIG_SMP
3159- runnable = shares = READ_ONCE (gcfs_rq -> tg -> shares );
3085+ shares = READ_ONCE (gcfs_rq -> tg -> shares );
31603086
31613087 if (likely (se -> load .weight == shares ))
31623088 return ;
31633089#else
31643090 shares = calc_group_shares (gcfs_rq );
3165- runnable = calc_group_runnable (gcfs_rq , shares );
31663091#endif
31673092
3168- reweight_entity (cfs_rq_of (se ), se , shares , runnable );
3093+ reweight_entity (cfs_rq_of (se ), se , shares );
31693094}
31703095
31713096#else /* CONFIG_FAIR_GROUP_SCHED */
@@ -3290,11 +3215,11 @@ void set_task_rq_fair(struct sched_entity *se,
32903215 * _IFF_ we look at the pure running and runnable sums. Because they
32913216 * represent the very same entity, just at different points in the hierarchy.
32923217 *
3293- * Per the above update_tg_cfs_util() is trivial and simply copies the running
3294- * sum over (but still wrong, because the group entity and group rq do not have
3295- * their PELT windows aligned).
3218+ * Per the above update_tg_cfs_util() is trivial * and simply copies the
3219+ * running sum over (but still wrong, because the group entity and group rq do
3220+ * not have their PELT windows aligned).
32963221 *
3297- * However, update_tg_cfs_runnable () is more complex. So we have:
3222+ * However, update_tg_cfs_load () is more complex. So we have:
32983223 *
32993224 * ge->avg.load_avg = ge->load.weight * ge->avg.runnable_avg (2)
33003225 *
@@ -3375,11 +3300,11 @@ update_tg_cfs_util(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq
33753300}
33763301
33773302static inline void
3378- update_tg_cfs_runnable (struct cfs_rq * cfs_rq , struct sched_entity * se , struct cfs_rq * gcfs_rq )
3303+ update_tg_cfs_load (struct cfs_rq * cfs_rq , struct sched_entity * se , struct cfs_rq * gcfs_rq )
33793304{
33803305 long delta_avg , running_sum , runnable_sum = gcfs_rq -> prop_runnable_sum ;
3381- unsigned long runnable_load_avg , load_avg ;
3382- u64 runnable_load_sum , load_sum = 0 ;
3306+ unsigned long load_avg ;
3307+ u64 load_sum = 0 ;
33833308 s64 delta_sum ;
33843309
33853310 if (!runnable_sum )
@@ -3427,20 +3352,6 @@ update_tg_cfs_runnable(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cf
34273352 se -> avg .load_avg = load_avg ;
34283353 add_positive (& cfs_rq -> avg .load_avg , delta_avg );
34293354 add_positive (& cfs_rq -> avg .load_sum , delta_sum );
3430-
3431- runnable_load_sum = (s64 )se_runnable (se ) * runnable_sum ;
3432- runnable_load_avg = div_s64 (runnable_load_sum , LOAD_AVG_MAX );
3433-
3434- if (se -> on_rq ) {
3435- delta_sum = runnable_load_sum -
3436- se_weight (se ) * se -> avg .runnable_load_sum ;
3437- delta_avg = runnable_load_avg - se -> avg .runnable_load_avg ;
3438- add_positive (& cfs_rq -> avg .runnable_load_avg , delta_avg );
3439- add_positive (& cfs_rq -> avg .runnable_load_sum , delta_sum );
3440- }
3441-
3442- se -> avg .runnable_load_sum = runnable_sum ;
3443- se -> avg .runnable_load_avg = runnable_load_avg ;
34443355}
34453356
34463357static inline void add_tg_cfs_propagate (struct cfs_rq * cfs_rq , long runnable_sum )
@@ -3468,7 +3379,7 @@ static inline int propagate_entity_load_avg(struct sched_entity *se)
34683379 add_tg_cfs_propagate (cfs_rq , gcfs_rq -> prop_runnable_sum );
34693380
34703381 update_tg_cfs_util (cfs_rq , se , gcfs_rq );
3471- update_tg_cfs_runnable (cfs_rq , se , gcfs_rq );
3382+ update_tg_cfs_load (cfs_rq , se , gcfs_rq );
34723383
34733384 trace_pelt_cfs_tp (cfs_rq );
34743385 trace_pelt_se_tp (se );
@@ -3612,8 +3523,6 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
36123523 div_u64 (se -> avg .load_avg * se -> avg .load_sum , se_weight (se ));
36133524 }
36143525
3615- se -> avg .runnable_load_sum = se -> avg .load_sum ;
3616-
36173526 enqueue_load_avg (cfs_rq , se );
36183527 cfs_rq -> avg .util_avg += se -> avg .util_avg ;
36193528 cfs_rq -> avg .util_sum += se -> avg .util_sum ;
@@ -4074,14 +3983,12 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
40743983 /*
40753984 * When enqueuing a sched_entity, we must:
40763985 * - Update loads to have both entity and cfs_rq synced with now.
4077- * - Add its load to cfs_rq->runnable_avg
40783986 * - For group_entity, update its weight to reflect the new share of
40793987 * its group cfs_rq
40803988 * - Add its new weight to cfs_rq->load.weight
40813989 */
40823990 update_load_avg (cfs_rq , se , UPDATE_TG | DO_ATTACH );
40833991 update_cfs_group (se );
4084- enqueue_runnable_load_avg (cfs_rq , se );
40853992 account_entity_enqueue (cfs_rq , se );
40863993
40873994 if (flags & ENQUEUE_WAKEUP )
@@ -4158,13 +4065,11 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
41584065 /*
41594066 * When dequeuing a sched_entity, we must:
41604067 * - Update loads to have both entity and cfs_rq synced with now.
4161- * - Subtract its load from the cfs_rq->runnable_avg.
41624068 * - Subtract its previous weight from cfs_rq->load.weight.
41634069 * - For group entity, update its weight to reflect the new share
41644070 * of its group cfs_rq.
41654071 */
41664072 update_load_avg (cfs_rq , se , UPDATE_TG );
4167- dequeue_runnable_load_avg (cfs_rq , se );
41684073
41694074 update_stats_dequeue (cfs_rq , se , flags );
41704075
@@ -7649,9 +7554,6 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
76497554 if (cfs_rq -> avg .util_sum )
76507555 return false;
76517556
7652- if (cfs_rq -> avg .runnable_load_sum )
7653- return false;
7654-
76557557 return true;
76567558}
76577559
0 commit comments