This bash script provides a straightforward interface for managing CPU scaling governors on Linux systems. It allows users to display the current CPU scaling governor for each CPU and change the governor to one of the available options.
- Display the current CPU scaling governor for each CPU.
- Change the CPU scaling governor to one of the following options:
- performance
- powersave
- ondemand
- userspace
- conservative
- schedutil
- Run the script in a terminal by doing (The script can be found here):
./cpuGovernor
-
Choose one of the two options:
- 1 to show the current CPU Scaling Governor.
- 2 to change the CPU Scaling Governor.
-
If changing the governor, enter the desired governor when prompted.
The choice of CPU scaling governor should be based on your system's needs and priorities, such as performance or power efficiency. Here's a brief guide to help you decide:
- performance: Maximizes computational performance without regard to power consumption.
- powersave: Minimizes power consumption at the expense of computational performance.
- ondemand: Dynamically increases CPU speed when needed, offering a balance between performance and power usage.
- conservative: Similar to ondemand but increases CPU frequency more gradually.
- schedutil: Makes scaling decisions based on the scheduler's load tracking, potentially offering better efficiency.
- Workload Characteristics:
- CPU Intensity: If the tasks are CPU-intensive and require quick completion, then considering higher clock frequencies is necesary.
- Task Urgency: If the tasks can afford slower processing times in exchange for energy savings, then lower clock frequencies is fine.
- Energy vs. Performance Priorities:
- Minimizing Energy Consumption: If energy efficiency is a priority, a governor like ‘powersave’ may be suitable as it sets the CPU statically to the lowest frequency within operational limits.
- Maximizing Performance: If performance is critical, the ‘performance’ governor may be more appropriate as it sets the CPU statically to the highest frequency within the scaling range.
##References
- Kernel Documentation. (2017). CPU Performance Scaling. Retrieved from https://www.kernel.org/doc/html/v4.14/admin-guide/pm/cpufreq.html
- Stack Exchange. (2018). What are the implications of setting the CPU governor to “performance”? Retrieved from https://unix.stackexchange.com/questions/439340/what-are-the-implications-of-setting-the-cpu-governor-to-performance