fc2ブログ

PowerTOP と RFKill で CentOS の省電力化に挑戦

ざるそば

長らく使っていなかった一昔前のネットブック Gateway LT-23 (2010 年発売) に、CentOS 7 をインストールしました。

常時起動するにはやはり電気代が気になります。ということで、頑張って省電力化を図って見ることにしました。

まず、通常はディスプレイを閉じた状態で置いておくつもりですが、デフォルトだと閉じることでスリープに入ってしまいます。
まずは閉じてもディスプレイが消えるだけの状態にします。

/etc/systemd/logind.conf を編集して、コメントアウトされている以下の行を変更します。
#HandleLidSwitch=suspend
これを
HandleLidSwitch=ignore
こうして、サービス再起動!
# systemctl restart systemd-logind
これでディスプレイを閉じてもスリープしなくなりました。

ここからはディスプレイを閉じた状態で作業を進めます (SSH で接続しています)。

以下の 2 つのソフトウェアをインストールします。
  • PowerTOP
  • RFKill

PowerTOP
プロセスやハードウェアが消費している電力を一覧表示してくれるソフトです。省電力設定もできます。こちらがとっても詳しいです。

RFKill
搭載されている無線機器の一覧表示、および有効 (unblock) と無効化 (softblock / hardblock) ができるソフトです。

それぞれさくっと yum でインストールできました。
# yum install powertop rfkill 
AC アダプタを外してバッテリー駆動状態で PowerTOP を起動することで、消費電力を見ることができます。
# powertop
20 秒くらいで自動更新されるので、2 回目から 6 回目までの 5 回の消費電力を見てみました。
  • The battery reports a discharge rate of 5.14 W
  • The battery reports a discharge rate of 5.21 W
  • The battery reports a discharge rate of 5.22 W
  • The battery reports a discharge rate of 5.08 W
  • The battery reports a discharge rate of 5.31 W

平均で 5.19 W でした。あれ、元々あまり食わないんだなぁ。本当なのか…?

PowerTOP には、--auto-tune というオプションがあって、これでチューニング可能な項目をすべて自動設定してくれます。
# powertop --auto-tune
が、CentOS でインストールできる PowerTOP 2.3 では自動設定が効かないようです。なんてこった…。

というわけで、試しに「Tunables」タブにある「Bad」項目をすべて手で「Good」に変更し、変化するかを見てみました。(やっていいのかわからない項目が多いのが正直なところですが、再起動すれば戻ります)
  • The battery reports a discharge rate of 4.89 W
  • The battery reports a discharge rate of 4.83 W
  • The battery reports a discharge rate of 4.81 W
  • The battery reports a discharge rate of 4.87 W
  • The battery reports a discharge rate of 4.80 W

平均で 4.84 W ! 0.35 W ほど下がりました。

一度再起動し、元の状態に戻して今度は RFKill の効果を見てみます。

以下のコマンドで、搭載されている無線デバイスの一覧を見ることができます。
# rfkill list
0: acer-wireless: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: acer-bluetooth: Bluetooth
        Soft blocked: no
        Hard blocked: no
2: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
3: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
なんだか 4 つほど見えますが、Wi-Fi も Bluetooth も使いませんので、すべて block してみます。
# rfkill block all
# rfkill list
0: acer-wireless: Wireless LAN
        Soft blocked: yes
        Hard blocked: no
1: acer-bluetooth: Bluetooth
        Soft blocked: yes
        Hard blocked: no
3: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: yes
デバイスが 1 つ消えましたが、block はできたようです。 ふたたび、PowerTOP を見てみます。
  • The battery reports a discharge rate of 4.95 W
  • The battery reports a discharge rate of 4.89 W
  • The battery reports a discharge rate of 4.91 W
  • The battery reports a discharge rate of 5.38 W
  • The battery reports a discharge rate of 4.94 W

なぜか 1 回上がってしまいましたが、平均的には少し下がったようです。

もう一度、PowerTOP の Tunable 項目を Good にして見ると、
  • The battery reports a discharge rate of 4.55 W
  • The battery reports a discharge rate of 4.44 W
  • The battery reports a discharge rate of 4.45 W
  • The battery reports a discharge rate of 4.48 W
  • The battery reports a discharge rate of 4.59 W

平均で 4.5 W !! 何もしないときより、0.7 W ほど省電力できました。

なんだか苦労したわりに効果が小さい気もしますが、PowerTOP も RFKill も再起動で元に戻る (RFKill は部分的に戻るようですが) ので、再起動に備えて自動起動用スクリプトを書くとよさそうですね。

標準テキスト CentOS 7 構築・運用・管理パーフェクトガイド
有限会社ナレッジデザイン 大竹 龍史 市来 秀男 山本 道子 山崎 佳子
SBクリエイティブ
売り上げランキング: 43,935
Posted byざるそば

Comments 0

There are no comments yet.

Leave a reply