Set CPU governor policy always “Performance” on Ubuntu

$ sudo apt-get install cpufrequtils

/etc/default/cpufrequtils 파일 생성. 있으면 수정.

$ sudo nano /etc/default/cpufrequtils

GOVERNOR="performance"
MIN_SPEED="2000MHz"

MIN_SPEED는 각자의 CPU 성능에 따라 설정함.

ondemand 서비스를 비활성화

$ sudo systemctl disable ondemand

파일이 생성되면, cpufrequtils 서비스를 재실행

$ sudo systemctl restart cpufrequtils

이제 cpufreq-info를 통해 확인해보면…

$ cpufreq-info                                                                                                                                                         
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009                                                                                                                                          
Report errors and bugs to cpufreq@vger.kernel.org, please.                                                                                                                                              
analyzing CPU 0:                                                                                                                                                                                        
  driver: intel_pstate                                                                                                                                                                                  
  CPUs which run at the same hardware frequency: 0                                                                                                                                                      
  CPUs which need to have their frequency coordinated by software: 0                                                                                                                                    
  maximum transition latency: 4294.55 ms.                                                                                                                                                               
  hardware limits: 800 MHz - 5.10 GHz                                                                                                                                                                   
  available cpufreq governors: performance, powersave                                                                                                                                                   
  current policy: frequency should be within 3.00 GHz and 5.10 GHz.                                                                                                                                     
                  The governor "performance" may decide which speed to use                                                                                                                              
                  within this range.                                                                                                                                                                    
  current CPU frequency is 4.91 GHz.                                                                                                                                                                    
analyzing CPU 1:                                                                                                                                                                                        
  driver: intel_pstate                                                                                                                                                                                  
  CPUs which run at the same hardware frequency: 1                                                                                                                                                      
  CPUs which need to have their frequency coordinated by software: 1                                                                                                                                    
  maximum transition latency: 4294.55 ms.                                                                                                                                                               
  hardware limits: 800 MHz - 5.10 GHz                                                                                                                                                                   
  available cpufreq governors: performance, powersave                                                                                                                                                   
  current policy: frequency should be within 3.00 GHz and 5.10 GHz.                                                                                                                                     
                  The governor "performance" may decide which speed to use                                                                                                                              
                  within this range.                                                                                                                                                                    
  current CPU frequency is 4.73 GHz.           

위와 같이 performance 모드로 셋팅되어 있고, CPU frequency가 올라가 있음을 확인할 수 있음.