@@ -12279,27 +12279,11 @@ void update_max_interval(void)
1227912279 max_load_balance_interval = HZ * num_online_cpus ()/10 ;
1228012280}
1228112281
12282- static inline void update_newidle_stats (struct sched_domain * sd , unsigned int success )
12283- {
12284- sd -> newidle_call ++ ;
12285- sd -> newidle_success += success ;
12286-
12287- if (sd -> newidle_call >= 1024 ) {
12288- sd -> newidle_ratio = sd -> newidle_success ;
12289- sd -> newidle_call /= 2 ;
12290- sd -> newidle_success /= 2 ;
12291- }
12292- }
12293-
12294- static inline bool
12295- update_newidle_cost (struct sched_domain * sd , u64 cost , unsigned int success )
12282+ static inline bool update_newidle_cost (struct sched_domain * sd , u64 cost )
1229612283{
1229712284 unsigned long next_decay = sd -> last_decay_max_lb_cost + HZ ;
1229812285 unsigned long now = jiffies ;
1229912286
12300- if (cost )
12301- update_newidle_stats (sd , success );
12302-
1230312287 if (cost > sd -> max_newidle_lb_cost ) {
1230412288 /*
1230512289 * Track max cost of a domain to make sure to not delay the
@@ -12347,7 +12331,7 @@ static void sched_balance_domains(struct rq *rq, enum cpu_idle_type idle)
1234712331 * Decay the newidle max times here because this is a regular
1234812332 * visit to all the domains.
1234912333 */
12350- need_decay = update_newidle_cost (sd , 0 , 0 );
12334+ need_decay = update_newidle_cost (sd , 0 );
1235112335 max_cost += sd -> max_newidle_lb_cost ;
1235212336
1235312337 /*
@@ -12990,37 +12974,17 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf)
1299012974 break ;
1299112975
1299212976 if (sd -> flags & SD_BALANCE_NEWIDLE ) {
12993- unsigned int weight = 1 ;
12994-
12995- if (sched_feat (NI_RANDOM )) {
12996- /*
12997- * Throw a 1k sided dice; and only run
12998- * newidle_balance according to the success
12999- * rate.
13000- */
13001- u32 d1k = sched_rng () % 1024 ;
13002- weight = 1 + sd -> newidle_ratio ;
13003- if (d1k > weight ) {
13004- update_newidle_stats (sd , 0 );
13005- continue ;
13006- }
13007- weight = (1024 + weight /2 ) / weight ;
13008- }
1300912977
1301012978 pulled_task = sched_balance_rq (this_cpu , this_rq ,
1301112979 sd , CPU_NEWLY_IDLE ,
1301212980 & continue_balancing );
1301312981
1301412982 t1 = sched_clock_cpu (this_cpu );
1301512983 domain_cost = t1 - t0 ;
12984+ update_newidle_cost (sd , domain_cost );
12985+
1301612986 curr_cost += domain_cost ;
1301712987 t0 = t1 ;
13018-
13019- /*
13020- * Track max cost of a domain to make sure to not delay the
13021- * next wakeup on the CPU.
13022- */
13023- update_newidle_cost (sd , domain_cost , weight * !!pulled_task );
1302412988 }
1302512989
1302612990 /*
0 commit comments