• Peng Wang's avatar
    schied/fair: Skip calculating @contrib without load · d040e073
    Peng Wang authored
    Because of the:
    
    	if (!load)
    		runnable = running = 0;
    
    clause in ___update_load_sum(), all the actual users of @contrib in
    accumulate_sum():
    
    	if (load)
    		sa->load_sum += load * contrib;
    	if (runnable)
    		sa->runnable_load_sum += runnable * contrib;
    	if (running)
    		sa->util_sum += contrib << SCHED_CAPACITY_SHIFT;
    
    don't happen, and therefore we don't care what @contrib actually is and
    calculating it is pointless.
    
    If we count the times when @load equals zero and not as below:
    
    	if (load) {
    		load_is_not_zero_count++;
    		contrib = __accumulate_pelt_segments(periods,
    				1024 - sa->period_contrib,delta);
    	} else
    		load_is_zero_count++;
    
    As we can see, load_is_zero_count is much bigger than
    load_is_zero_count, and the gap is gradually widening:
    
    	load_is_zero_count:            6016044 times
    	load_is_not_zero_count:         244316 times
    	19:50:43 up 1 min,  1 user,  load average: 0.09, 0.06, 0.02
    
    	load_is_zero_count:            7956168 times
    	load_is_not_zer...
    d040e073
pelt.c 10.7 KB