Ondemand和Interactive gonernor工作逻辑简述

  • ondemand

 简述:

1、采样时间:sampling_rate,单位us

2、cpu usage是仅统计最新1us的一个smaple周期,以%体现cpu busy程度。

3、一般情况下,next频率f = fmin + busy% * (fmax-fmin);如果busy% > up_threshold,那频率都直接设为fmax。

4、处于fmax的时间为smapling_down_factor。

  • Interactive

 简述:

1、采样时间为timer_rate,单位Lus

2、cpu usage也是使用最新1us的一个采样周期,以%体现cpu busy程度。

3、一般情况下,根据target_loads,选择对应的cpu频率;如果cpu busy% > go_his_speed_load,那么cpu频率需设为hisspeed_freq

如上图中配置:表示负载在 85% 以下时,CPU 频率要运行在 1GHz 以下;负载达到 90% 时,CPU 频率要运行在 1.0GHz~1.7GHz,直到 CPU 负载达到 99% 时,频率才会升到 1.7GHz 以上。

4、min_sample_time时间用来实现缓慢降低cpu freq。也可以简单理解成 CPU 两次降频之间的间隔值。

5、在设置 hispeed_freq时,可以使用above_hispeed_delay来延迟频率提升。

 采样

上面2中governor都提到sample,采样是如下的工作方式:

假设现在fmin= 100MHz, fmax = 1000MHz。而policy是f = util*fmax + 100MHz。

 从图中可以看到基于采样方式的cpu调频都会出现一些问题,如图中oops。还有在exiting task、migrate task时都会有一些缺陷。

参考:https://connect.linaro.org/resources/bkk16/bkk16-104

猜你喜欢

转载自www.cnblogs.com/lingjiajun/p/12912594.html