Текущее в
Дистрибутивcat /etc/altlinux-release
ALT Linux p7 (Trientalis)
Ядро# uname -r
3.10.11-std-def-alt1
Доступные гувенёры# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand performance
Текущий гувернёр# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand
Процессор# cat /proc/cpuinfo | grep -i "model name"
model name: Intel(R) Core(TM)2 Duo CPU E4700 @ 2.60GHz
model name: Intel(R) Core(TM)2 Duo CPU E4700 @ 2.60GHz
# cpufreq-info -m
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
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.20 GHz - 2.60 GHz
available frequency steps: 2.60 GHz, 2.00 GHz, 1.60 GHz, 1.20 GHz
available cpufreq governors: ondemand, performance
current policy: frequency should be within 1.20 GHz and 2.60 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 1.20 GHz (asserted by call to hardware).
cpufreq stats: 2.60 GHz:0,78%, 2.00 GHz:0,02%, 1.60 GHz:0,05%, 1.20 GHz:99,15% (3988)
analyzing CPU 1:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 10.0 us.
hardware limits: 1.20 GHz - 2.60 GHz
available frequency steps: 2.60 GHz, 2.00 GHz, 1.60 GHz, 1.20 GHz
available cpufreq governors: ondemand, performance
current policy: frequency should be within 1.20 GHz and 2.60 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 1.20 GHz (asserted by call to hardware).
cpufreq stats: 2.60 GHz:1,24%, 2.00 GHz:0,05%, 1.60 GHz:0,16%, 1.20 GHz:98,54% (5553)
cat /etc/sysfs.conf
#
# /etc/sysfs.conf - Configuration file for setting sysfs attributes.
#
# The sysfs mount directory is automatically prepended to the attribute paths.
#
# Syntax:
# attribute = value
# mode attribute = 0600 # (any valid argument for chmod)
# owner attribute = root:wheel # (any valid argument for chown)
#
# Examples:
#
# Always use the powersave CPU frequency governor
# devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave
#
# Use userspace CPU frequency governor and set initial speed
# devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace
# devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000
#
# Set permissions of suspend control file
# owner power/state = root:power
# mode power/state = 0660
Настройка гувернёров для процессоров Intel (Core2 Duo) выбирается из
# modinfo /lib/modules/$(uname -r)/kernel/drivers/cpufreq/* | grep ^[fd]
Что есть для Intel?
# ls -1F /lib/modules/$(uname -r)/kernel/drivers/cpufreq/ | grep cpufreq
acpi-cpufreq.ko
cpufreq_conservative.ko
cpufreq-nforce2.ko
cpufreq_ondemand.ko
cpufreq_powersave.ko
cpufreq_stats.ko
cpufreq_userspace.ko
pcc-cpufreq.ko
Для Intel
# cat /proc/cpuinfo | grep -i "model name"
model name: Intel(R) Core(TM)2 Duo CPU E4700 @ 2.60GHz
model name: Intel(R) Core(TM)2 Duo CPU E4700 @ 2.60GHz
двухядерного
# cat /proc/cpuinfo | grep -i "core id"
core id: 0
core id: 1
добавляем для загрузки драйвер и модули гувернёров в /etc/modules
# ls -1F /lib/modules/$(uname -r)/kernel/drivers/cpufreq/ | grep cpufreq >> /etc/modules
Приводим к виду для Intel(tm) Core2 Duo
# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a `#', and everything on the line after them are ignored.
acpi-cpufreq
cpufreq_conservative
cpufreq_ondemand
cpufreq_stats
cpufreq_userspace
Гувернёр для ноута без розетки
# modinfo /lib/modules/$(uname -r)/kernel/drivers/cpufreq/* | grep ^[fd] | grep cpufreq_cons
filename: /lib/modules/3.10.11-std-def-alt1/kernel/drivers/cpufreq/cpufreq_conservative.ko
description: 'cpufreq_conservative' - A dynamic cpufreq governor for Low Latency Frequency Transition capable processors optimised for use in a battery environment
конфигурируем, например гувернёр
conservative(См. количество и нумерацию ядер из команды 'cat /proc/cpuinfo | grep -i "core id"' выше)
# echo "devices/system/cpu/cpu0/cpufreq/scaling_governor = conservative" >> /etc/sysfs.conf
# echo "devices/system/cpu/cpu1/cpufreq/scaling_governor = conservative" >> /etc/sysfs.conf
Перегружаемся.
После перезагрузки получаем :# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
userspace powersave ondemand conservative performance
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
2600000 2000000 1600000 1200000
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
conservative
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
1200000
# cpufreq-info -d
acpi-cpufreq
или равнозначно
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
acpi-cpufreq
# lsmod|grep cpu
cpufreq_userspace 1731 0
cpufreq_stats 3541 0
cpufreq_powersave 734 0
cpufreq_ondemand 8176 0
cpufreq_conservative 6214 2
acpi_cpufreq 6975 0
mperf 1231 1 acpi_cpufreq
processor 27378 1 acpi_cpufreq
$ sensors
nouveau-pci-0100
Adapter: PCI adapter
temp1: +58.0°C (high = +95.0°C, hyst = +3.0°C)
(crit = +105.0°C, hyst = +5.0°C)
(emerg = +130.0°C, hyst = +10.0°C)
atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage: +1.07 V (min = +0.85 V, max = +1.60 V)
+3.3 Voltage: +3.30 V (min = +2.97 V, max = +3.63 V)
+5 Voltage: +4.97 V (min = +4.50 V, max = +5.50 V)
+12 Voltage: +12.41 V (min = +10.20 V, max = +13.80 V)
CPU FAN Speed: 1110 RPM (min = 600 RPM, max = 7200 RPM)
CHASSIS1 FAN Speed: 0 RPM (min = 800 RPM, max = 7200 RPM)
CHASSIS2 FAN Speed: 0 RPM (min = 800 RPM, max = 7200 RPM)
POWER FAN Speed: 1360 RPM (min = 800 RPM, max = 7200 RPM)
CPU Temperature: +41.0°C (high = +60.0°C, crit = +95.0°C)
MB Temperature: +37.0°C (high = +45.0°C, crit = +95.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +33.0°C (high = +78.0°C, crit = +100.0°C)
Core 1: +38.0°C (high = +78.0°C, crit = +100.0°C)
cat /etc/altlinux-release
ALT Linux p7 (Trientalis)
Смена гувернёра без перезагрузки системыКак выглядят в
/etc/sysfs.conf строки конфигурации текущего гувернёра
(вывести на печать из файла
/etc/sysfs.conf все строки начинающиеся с
devi)
# cat /etc/sysfs.conf | grep ^devi
devices/system/cpu/cpu0/cpufreq/scaling_governor = conservative
devices/system/cpu/cpu1/cpufreq/scaling_governor = conservative
После смены гувернёра,
consevative на
ondemand в
/etc/sysfs.conf например через
mcedit,
(см. выше)
# mcedit /etc/sysfs.conf
выполнить:
Информация о сервисе
# chkconfig sysfs --list
sysfs 0:выкл 1:выкл 2:вкл 3:вкл 4:вкл 5:вкл 6:выкл
Рестартануть сервис
# service sysfs restart
Setting sysfs variables... [ DONE ]
Убедиться, что гувернёр сменился
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand
Альтернативный UNIX-like вариант смены гувернёра без перезагрузки системыИли как обойтись без mcedit и chkconfigКакой гувернёр описан в файле
/etc/sysfs.conf(печатать только строки содержащие регуляное выражение
devi в начале строки)
# sed -n '/^devi/p' /etc/sysfs.conf
devices/system/cpu/cpu0/cpufreq/scaling_governor = conservative
devices/system/cpu/cpu1/cpufreq/scaling_governor = conservative
Спойлер
Альтернативный вариант от обратного:
показать всё содержимое /etc/sysfs.conf кроме комментариев
# sed -n '/^#/!p' /etc/sysfs.conf
Буквально:
- вывести на печать содержимое файла /etc/sysfs.conf
- не выводить на печать строки начинающиеся с символа #
Смена гувернёра
conservative на
ondemand в файле
/etc/sysfs.conf(заменить во всех строках регулярное выражение
conservative на
ondemand исключая все строки начинающиеся с символа
#)
# sed '/^#/!s/conservative/ondemand/g' /etc/sysfs.conf
Спойлер
#
# /etc/sysfs.conf - Configuration file for setting sysfs attributes.
#
# The sysfs mount directory is automatically prepended to the attribute paths.
#
# Syntax:
# attribute = value
# mode attribute = 0600 # (any valid argument for chmod)
# owner attribute = root:wheel # (any valid argument for chown)
#
# Examples:
#
# Always use the powersave CPU frequency governor
# devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave
#
# Use userspace CPU frequency governor and set initial speed
# devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace
# devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000
#
# Set permissions of suspend control file
# owner power/state = root:power
# mode power/state = 0660
devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand
devices/system/cpu/cpu1/cpufreq/scaling_governor = ondemand
Информация о сервисе
# ls -l $(find /etc/rc.d -name *sysfs)
-rwxr-xr-x 1 root root 2049 апр 19 05:16 /etc/rc.d/init.d/sysfs
lrwxrwxrwx 1 root root 15 апр 28 00:26 /etc/rc.d/rc0.d/K67sysfs -> ../init.d/sysfs
lrwxrwxrwx 1 root root 15 апр 28 00:26 /etc/rc.d/rc1.d/K67sysfs -> ../init.d/sysfs
lrwxrwxrwx 1 root root 15 апр 28 00:26 /etc/rc.d/rc2.d/S33sysfs -> ../init.d/sysfs
lrwxrwxrwx 1 root root 15 апр 28 00:26 /etc/rc.d/rc3.d/S33sysfs -> ../init.d/sysfs
lrwxrwxrwx 1 root root 15 апр 28 00:26 /etc/rc.d/rc4.d/S33sysfs -> ../init.d/sysfs
lrwxrwxrwx 1 root root 15 апр 28 00:26 /etc/rc.d/rc5.d/S33sysfs -> ../init.d/sysfs
lrwxrwxrwx 1 root root 15 апр 28 00:26 /etc/rc.d/rc6.d/K67sysfs -> ../init.d/sysfs
# cat /etc/init.d/sysfs | grep 'chkconfig'
# chkconfig: 2345 33 67
S33 - очередь загрузки, K67 - очередь останова, rc0-rc6 (/etc/rc.d/rc0.d/ - /etc/rc.d/rc6.d/) - на каких уровнях что будет выполняться
Как можно использовать сервис
# /etc/init.d/sysfs usage
Usage: sysfs {start|stop|reload|restart|condstop|condrestart|condreload|status}
Рестарт сервиса
# /etc/init.d/sysfs restart
Setting sysfs variables... [ DONE ]
После чего изменения в /etc/sysfs.conf вступят в силу.
Команды используемые в обоих вариантах вы конечно можете комбинировать, выбирая тот инструмент, который удобнее.
Дополнительные пакеты для настройки и информацииНужен для принудительного выбора гувенёра (см. выше в командах /etc/sysfs.conf):# rpm -q sysfsutils
sysfsutils-2.1.0-alt6.1.qa1
# rpm -ql sysfsutils | grep conf
/etc/sysfs.conf
# rpm -q cpufrequtils
cpufrequtils-008-alt1.1
Полезные ссылки:http://www.altlinux.org/Cpufreqhttp://www.thinkwiki.org/wiki/How_to_make_use_of_Dynamic_Frequency_Scalinghttp://ant0.ru/sed1line.htmlhttp://ant0.ru/sed.htmlhttp://it-cat.biz/ru/operacionnye-sistemy-gnulinux/avtozapusk-sluzhb-demonovhttps://wiki.archlinux.org/index.php/CPU_Frequency_Scalinghttps://www.kernel.org/doc/Documentation/kernel-parameters.txt intel_pstate= [X86]
disable
Do not enable intel_pstate as the default
scaling driver for the supported processors
В отношении
intel_pstate это справедливо для
Intel CPUhttp://www.spinics.net/lists/cpufreq/msg06261.htmlIntel Architecture and Processor Identification With CPUID Model and Family NumbersНу и да,
в свете сегодняшнего (начиная вроде бы с ядра 3.9, для процессоров 'Core iX' и выше), не забыть про
в параметрах запуска ядра ставьте intel_pstate=disable
чтобы поднялся acpi-cpufreq