cpufreq sys 接口解读

   

  cpufreq是内核针对cpu调频设计的统一驱动框架,这在网上有大量资料,就不再赘述。

  在此,主要关心 

1) intel cpu 调频驱动的参数 配置和cpufreq的参数的关系。

      scaling_max_freq    max_perf_pct   在设置max_perf_pct后,max_freq是受影响的,例如CPU最高频率为4GHZ,设置perf为 30%,则max_freq的值会变为 1.2,如果此时也设置max_freq呢,那它的值是怎么样的?两者有先后覆盖关系吗?

     scaling_min_freq    min_perf_pct  对于下限区间,存在同样的问题。

2) 对于scaling_max_freq ,scaling_min_freq,这个不能理解为CPU的最大最小频率,而是cpufreq对CPU进行调频的范围,可以和CPU支持的范围相同,也可以不同。

3)scaling_governor。 相当于调频的策略。

    对于intel_pstate支持两个值,performance 和powersave。网上大量资料都说performace是固定在最高频率;powersave是固定在最低频率。实际则不然。

    根据实际测试,当配置为performance时,用i7z工具查看cpu频率,的确在最高频率。

    然而配置为powersave时,通过i7z查看,频率是动态变化的

   查阅内核文档 : intel_pstate CPU Performance Scaling Driver — The Linux Kernel documentation

   可以知晓: powersave 是根据当前cpu 利用率选择合适的p态,并非固定在最低频率。

   

performance

Without HWP, this P-state selection algorithm is always the same regardless of the processor model and platform configuration.

It selects the maximum P-state it is allowed to use, subject to limits set via sysfs, every time the driver configuration for the given CPU is updated (e.g. via sysfs).

This is the default P-state selection algorithm if the CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE kernel configuration option is set.

powersave

Without HWP, this P-state selection algorithm is similar to the algorithm implemented by the generic schedutil scaling governor except that the utilization metric used by it is based on numbers coming from feedback registers of the CPU. It generally selects P-states proportional to the current CPU utilization.

This algorithm is run by the driver’s utilization update callback for the given CPU when it is invoked by the CPU scheduler, but not more often than every 10 ms. Like in the performance case, the hardware configuration is not touched if the new P-state turns out to be the same as the current one.

   

    

   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

proware

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值