CPU Frequency Scaling: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
  make sure its running  
  make sure its running  
  ''/etc.rc.d/rc.cpufreq restart''
  ''/etc.rc.d/rc.cpufreq restart''
= Governor types =
'''Performance'''
The CPUfreq governor "performance" sets the CPU statically to the
highest frequency within the borders of scaling_min_freq and
scaling_max_freq.
'''Powersave'''
The CPUfreq governor "powersave" sets the CPU statically to the
lowest frequency within the borders of scaling_min_freq and
scaling_max_freq.
'''Userspace'''
The CPUfreq governor "userspace" allows the user, or any userspace
program running with UID "root", to set the CPU to a specific frequency
by making a sysfs file "scaling_setspeed" available in the CPU-device
directory.
'''Ondemand'''
The CPUfreq governor "ondemand" sets the CPU frequency depending on the
current system load. Load estimation is triggered by the scheduler
through the update_util_data->func hook; when triggered, cpufreq checks
the CPU-usage statistics over the last period and the governor sets the
CPU accordingly.  The CPU must have the capability to switch the
frequency very quickly.
'''Conservative'''
The CPUfreq governor "conservative", much like the "ondemand"
governor, sets the CPU frequency depending on the current usage.  It
differs in behaviour in that it gracefully increases and decreases the
CPU speed rather than jumping to max speed the moment there is any load
on the CPU. This behaviour is more suitable in a battery powered
environment.




[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 13:11, 29 October 2018

The CPU frequency scaling feature present in modern computers allows lowering and increasing the processor speed dynamically in runtime so as to save energy while having the possibility of increasing the performance and power consumption if needed. Activating CPU frequency scaling under Slackware is very easy, and requires loading a minimum of two kernel modules and running a simple command. On the one hand, you need to load a specific CPU driver that will activate the frequency scaling feature in your platform. Second, you need to choose a CPU frequency scaling governor, a module that will decide how and when to change the internal processor speed. There are governors to always run at full speed, governors to always run at low speed, governors to increase and decrease the speed based on the CPU load, etc.


Find available governors

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors 


Setting a governor

edit /etc/default/cpufreq

Applying the governor

/etc/rc.d/rc.cpufreq should already be executable
make sure its running 
/etc.rc.d/rc.cpufreq restart


Governor types

Performance

The CPUfreq governor "performance" sets the CPU statically to the
highest frequency within the borders of scaling_min_freq and
scaling_max_freq.


Powersave

The CPUfreq governor "powersave" sets the CPU statically to the
lowest frequency within the borders of scaling_min_freq and
scaling_max_freq.


Userspace


The CPUfreq governor "userspace" allows the user, or any userspace
program running with UID "root", to set the CPU to a specific frequency
by making a sysfs file "scaling_setspeed" available in the CPU-device
directory.


Ondemand


The CPUfreq governor "ondemand" sets the CPU frequency depending on the
current system load. Load estimation is triggered by the scheduler
through the update_util_data->func hook; when triggered, cpufreq checks
the CPU-usage statistics over the last period and the governor sets the
CPU accordingly.  The CPU must have the capability to switch the
frequency very quickly.


Conservative


The CPUfreq governor "conservative", much like the "ondemand"
governor, sets the CPU frequency depending on the current usage.  It
differs in behaviour in that it gracefully increases and decreases the
CPU speed rather than jumping to max speed the moment there is any load
on the CPU. This behaviour is more suitable in a battery powered
environment.