2011년 1월 16일 일요일

데비안 리눅스에서 전원 관리하기

[출처] http://technowizah.com/2007/01/debian-how-to-power-management.html

* CPU 주파수 관리하기
다음을 실행하여 CPU 주파수 관리자의 상태를 점검하자.
# cpufreq-info
CPU 주파수 관리자가 꺼져 있다면, 다음을 따라가자.
다음을 설치하자.
# sudo apt-get install cpufrequtils sysfsutils
정확한 CPU 모델을 확인하자.
# cat /proc/cpuinfo | grep "model name"
출력은 다음과 같은 형식이어야 한다.
model name : Intel(R) Pentium(R) M processor 1.73GHz
정확한 CPU 모델이 확인되면, 다음 단계는 적절한 모듈을 로드할 단계이다.
: CPU frequency driver, CPU frequency policy governor

CPU frequency driver

CPU의 타입에 따른 CPU frequency driver가 다르다는 것을 짐작할 수 있듯이,
Pentium M을 갖는 laptop의 경우 다음과 같다.
# sudo modprobe speedstep_centrino
다른 CPU의 경우에 해당하는 CPU frequency driver는 다음과 같다.
AMD K6 processors : powernow_k6
AMD K7 processors (Athlon, Duron, Sempron 32 bits) : powernow_k7
AMD K8 processors (Athlon 64, Turion 64, Sempron 64, Opteron 64) : powernow_k8
Pentium 4, Celeron D, Pentium D, Celeron M : p4_clockmod
Pentium M, Core Duo, Core 2 Duo : speedstep_centrino
의심이 된다면 일반적인 드라이버를 사용할 수도 있다. : acpi_cpufreq

CPU policy governor

적절한 드라이버가 로드되면 CPU policy governor의 선택이 필요하다.
이 policy governor는 CPU의 실제 행동을 관리한다.
여기 약간의 policy governor와 그에 해당하는 모듈 이름이 있다.
performance, which sets the CPU statically to the highest possible frequency : cpufreq_performance
powersave, which is the opposite, clocks the CPU statically to the lowest frequency : cpufreq_powersave
ondemand, which sets the CPU speed dynamically depending on the work load (ideal for desktops) : cpufreq_ondemand
conservative, which also sets the CPU dynamically, but less aggressively then the ondemand governor (ideal for laptops) : cpufreq_conservative
예를 들면, Pentium M 프로세서의 경우
# sudo modprobe speedstep_centrino
# sudo modprobe cpufreq_ondemand
CPU 설정하기
두 모듈이 로드 되면 policy governor의 설정이 필요하다.
예를 들면 ondemand governor를 사용하려면 다음과 같은 라인을 수행한다.
# echo ondemand | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
이와 같은 명령들이 제대로 동작하고 있는지 다음 명령어로 점검해 보자.
# cpufreq-info
시스템 설정하기
모든것이 다 제대로 설정 된다면 이제는 설정을 영구적으로 수행될 수 있도록 만들자.
먼저 적절한 모듈들이 /etc/modules/ 밑에 있는지 확인하자.
내 경우 다음과 같다.
# echo speedstep_centrino | sudo tee -a /etc/modules
# echo cpufreq_ondemand | sudo tee -a /etc/modules
마지막으로 CPU가 적절한 governor를 사용하는지 확인하고,
다음 사항을 저장하자.

/etc/sysfs.conf
================================================================
devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand
================================================================

X 서버 설정하기
두 가지 방법이 있다. CPU/GPU의 소비 전력을 관리하기 위해 최적화 하는 방법과
suspend/resume하는 시스템의 동작에 관련된 사항을 수정하는 방법이 있다.

전원에 관한 설정
/etc/X11/xorg.conf
==============================================
...
Section "Screen"
...
DefaultDepth 16
...
Option "backingstore" "true"
...
Section "Device"
...
Option "RenderAccel" "true"
...
==============================================
ATI 비디오 카드의 사용자의 경우 수작업에 의한 트릭이 필요하다.
(ATI사의 드라이버를 설치하자)
그리고 다음 라인을 Section "Device"에 추가해서 GPU 주파수 관리를 활성화 하자.
Option "DynamicClocks" "true"
suspend/resume에 관한 설정
suspend-to-RAM으로 부터 resume하는 것을 돕기위해서 다음 코드를 추가하자.

/etc/X11/xorg.conf
==============================================
...
Section "Device"
...
Option "VBERestore" "true"
...
==============================================
* suspend to RAM
suspend-to-RAM이 적절히 작동하기 위해선, 약간의 행운과 약간의 작업이 필요하다.
저의 경우 laptop-mode-tools, hdparm, 등의 보조적인 도구들의 모음과 작동하는
Powersave를 사용한다.

설치하기
# sudo apt-get install acpi acpid acpi-tools hdparm sdparm laptop-detect laptop-mode-tools powersaved
또한 많은 사용자들이 이러한 유틸리티를 관리하는 graphical front end를 선호한다.
KDE 데스크탑의 경우 kpowersave를 GNOME의 경우 gnome-power-manager를 사용하자.
powersaved가 올바르게 동작하게 하기위해서 powerdev그룹에 사용자를 추가하자
# sudo adduser {your_username} powerdev
설정하기
이 부분은 트릭을 포함한다.
powersaved의 주요 설정 파일은 /etc/powersave/sleep이다.
다행이 변경하는데 단 몇 라인만 필요하다.
예를 들면, Asus Z63A 데스크탑에서는 변경하는데 5 라인이 필요하다.
==================================================
UNLOAD_MODULES_BEFORE_SUSPEND2RAM="sdhci"
SUSPEND2RAM_FORCE="yes"
SUSPEND2RAM_ACPI_SLEEP="1"
SUSPEND2RAM_VBE_SAVE="yes"
SUSPEND2DISK_METHOD="uswsusp"
==================================================
이상적인 경우 여기서 이야기하는 /etc/powersave/sleep 파일에 아무런 수정사항도 필요하지 않다.

댓글 없음:

댓글 쓰기