choose_freq分析
1 800000:85 998400:90 1094400:80 1190400:80 1248000:80 1305600:80
例子1: loadadjfreq=cpu_load*pcpu->policy->cur=92*998400
循环1:
prevfreq = freq=998400;
tl=90(998400:90) 通过当前频率找到下一级load
loadadjfreq / tl=1020500
cpufreq_frequency_table_target: start
target_freq=1020500
CPUFREQ_RELATION_L
freq=800,suboptimal.frequency = 800 suboptimal.driver_data=0;
freq=998.4,suboptimal.frequency = 998.4 suboptimal.driver_data=1;
freq=1094400,optimal.frequency = 1094400 optimal.driver_data=2
freq=1190400 1248000 1305600(不起作用) optimal.frequency = 1094400 i=5
*index = optimal.driver_data=2;
cpufreq_frequency_table_target: end
freq=1094400
freqmin = prevfreq=998400;
freqmax = UINT_MAX;
while (freq != prevfreq)进入循环2:
prevfreq = freq=1094400;
tl=80(1094400:80) 通过当前频率找到下一级load
loadadjfreq / tl=92*998400/80=1148160
cpufreq_frequency_table_target: start
target_freq=1148160
CPUFREQ_RELATION_L
freq=800,suboptimal.frequency = 800 suboptimal.driver_data=0;
freq=998.4,suboptimal.frequency = 998.4 suboptimal.driver_data=1;
freq=1094400,optimal.frequency = 1094400 optimal.driver_data=2
freq=1190400 1248000 1305600(不起作用) optimal.frequency = 1094400 i=5
*index = optimal.driver_data=2;
cpufreq_frequency_table_target: end
freq=1094400
freqmin = prevfreq=1094400;
freqmax = UINT_MAX;
while (freq != prevfreq)跳出循环
例子2: loadadjfreq=cpu_load*pcpu->policy->cur=60*1190400
1 800000:85 998400:90 1094400:80 1190400:80 1248000:80 1305600:80
循环1:
prevfreq = freq=1190400;
tl=80(1190400:80) 通过当前频率找到下一级load
loadadjfreq / tl=892800
cpufreq_frequency_table_target: start
target_freq=892800
CPUFREQ_RELATION_L
freq=800,suboptimal.frequency = 800 suboptimal.driver_data=0;
freq=998.4,optimal.frequency = 998.4 suboptimal.driver_data=1;
freq=1094400 1190400 1248000 1305600(不起作用) optimal.frequency = 1094400 i=5
*index = optimal.driver_data=1;
cpufreq_frequency_table_target: end
freq=998.400
freqmax = prevfreq=1190400; freqmin = 0;
freqmax = UINT_MAX;
while (freq != prevfreq)进入循环2:
prevfreq = freq=998.400;
tl=90(998400:90) 通过当前频率找到下一级load
loadadjfreq / tl=60*1190400/90=793600
cpufreq_frequency_table_target: start
target_freq=793600
CPUFREQ_RELATION_L
freq=800000,optimal.frequency = 800 optimal.driver_data=0;
freq=***1190400 1248000 1305600(不起作用) optimal.frequency = 1094400 i=5
*index = optimal.driver_data=0;
cpufreq_frequency_table_target: end
freq=800000
freqmin = 0;
freqmax = 998400;
while (freq != prevfreq)进入循环3:
prevfreq = freq=800000;
tl=85(800000:85) 通过当前频率找到下一级load
loadadjfreq / tl=60*1190400/85=840.282
cpufreq_frequency_table_target: start
target_freq=840.282
CPUFREQ_RELATION_L
freq=800,suboptimal.frequency = 800 suboptimal.driver_data=0;
freq=998.400,optimal.frequency = 998.400 suboptimal.driver_data=1;
freq=1094400 1190400 1248000 1305600(不起作用) optimal.frequency = 1094400 i=5
*index = optimal.driver_data=1;
cpufreq_frequency_table_target: end
freq=998.400
freqmin = prevfreq = 800000;
freqmax = 998400;
进入if (freq >= freqmax)
cpufreq_frequency_table_target: start
target_freq=freqmax-1=998339
CPUFREQ_RELATION_H
freq=800.000,optimal.frequency = 800.000 optimal.driver_data =0;
freq=998.4,suboptimal.frequency = 998.4 suboptimal.driver_data=1;
freq=1094400 1190400 1248000 1305600(不起作用) suboptimal.frequency = 1094400 i=5
*index = optimal.driver_data=0;
cpufreq_frequency_table_target: end
freq=800000
freqmin = 800000;
freq=freqmax = 998400;
跳出循环