2015年5月30日土曜日

CentOS7 の CPU 省電力機能について

先日、古い core2 世代のマシンで、CentOS 7 を動かしたのですが、CPU 温度がやけに高い現象に遭遇しました。
[root@hoge ~]# cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core) 
[root@hoge ~]# uname -a
Linux hoge 3.10.0-229.4.2.el7.x86_64 #1 SMP Wed May 13 10:06:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@hoge ~]# dmidecode -s processor-version
Intel(R) Core(TM)2 CPU         X6800  @ 2.93GHz
[root@hoge ~]# sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +69.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:       +69.0°C  (high = +86.0°C, crit = +100.0°C)
これは、もしや省電力機能が働いていないのではと思って見てみると。
[root@hoge ~]# cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.60 GHz - 2.93 GHz
  available frequency steps: 2.93 GHz, 2.13 GHz, 1.60 GHz
  available cpufreq governors: conservative, userspace, powersave, ondemand, performance
  current policy: frequency should be within 1.60 GHz and 2.93 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 2.93 GHz (asserted by call to hardware).
  cpufreq stats: 2.93 GHz:100.00%, 2.13 GHz:0.00%, 1.60 GHz:0.00%  (24)
  boost state support:
    Supported: no
    Active: no
確かに常時最高周波数になっているようでした。調べてみると、cpupower.service というものがあり、これが CentOS 7 では、デフォルトでは disable になっているようです。
[root@hoge ~]# systemctl list-unit-files | grep cpupower
cpupower.service                            disabled
というわけで、このサービスを起動したら解決しました。温度下がりました(周波数下がりました)。
[root@hoge ~]# systemctl start cpupower.service
[root@hoge ~]# systemctl status cpupower.service 
cpupower.service - Configure CPU power related settings
   Loaded: loaded (/usr/lib/systemd/system/cpupower.service; enabled)
   Active: active (exited) since Tue 2015-05-26 08:49:07 JST; 21min ago
 Main PID: 22330 (code=exited, status=0/SUCCESS)

May 26 08:49:07 hoge cpupower[22330]: Setting cpu: 0
May 26 08:49:07 hoge cpupower[22330]: Setting cpu: 1
May 26 08:49:07 hoge systemd[1]: Started Configure CPU power related settings.

※しばらく時間を置いて温度を確認

[root@hoge ~]# sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +59.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:       +59.0°C  (high = +86.0°C, crit = +100.0°C)

[root@hoge ~]# cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.60 GHz - 2.93 GHz
  available frequency steps: 2.93 GHz, 2.13 GHz, 1.60 GHz
  available cpufreq governors: conservative, userspace, powersave, ondemand, performance
  current policy: frequency should be within 1.60 GHz and 2.93 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.60 GHz (asserted by call to hardware).
  cpufreq stats: 2.93 GHz:63.15%, 2.13 GHz:0.98%, 1.60 GHz:35.87%  (631)
  boost state support:
    Supported: no
    Active: no
なお、最近のマシン(Core i 世代)だと、cpupower.service が起動していなくても、省電力になるようです(つまり、RHEL7/CentOS7 のデフォルトで最適な状態になっている)。
気になる方は、cpupower コマンドや turbostat コマンドで確認してみては。


2016-10-01追記
手持ちの Core i7 (ThinkPad W520) だと、こんな感じ。何もしなくても、デフォルトで良い感じです。
[root@w520 ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
[root@w520 ~]# uname -a
Linux w520 3.10.0-327.36.1.el7.x86_64 #1 SMP Sun Sep 18 13:04:29 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@w520 ~]# dmidecode -s processor-version
Intel(R) Core(TM) i7-2960XM CPU @ 2.70GHz
[root@w520 ~]# systemctl status cpupower.service
* cpupower.service - Configure CPU power related settings
   Loaded: loaded (/usr/lib/systemd/system/cpupower.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@w520 ~]# sensors coretemp-isa-0000
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +61.0°C  (high = +86.0°C, crit = +100.0°C)
Core 0:         +58.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:         +58.0°C  (high = +86.0°C, crit = +100.0°C)
Core 2:         +55.0°C  (high = +86.0°C, crit = +100.0°C)
Core 3:         +61.0°C  (high = +86.0°C, crit = +100.0°C)

[root@w520 ~]# cpupower frequency-info
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 0.97 ms.
  hardware limits: 800 MHz - 3.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 800 MHz and 3.70 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 862 MHz (asserted by call to hardware).
  boost state support:
    Supported: yes
    Active: yes
    3400 MHz max turbo 4 active cores
    3400 MHz max turbo 3 active cores
    3600 MHz max turbo 2 active cores
    3700 MHz max turbo 1 active cores

0 件のコメント:

コメントを投稿

人気ブログランキングへ にほんブログ村 IT技術ブログへ