From: Tom Hughes Date: Fri, 29 Mar 2019 09:00:32 +0000 (+0000) Subject: Don't try and tune the ondemand governor on machines that don't use it X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/bc81b92d0609f2b1d5e99cba5301b5e52267e6a0?ds=sidebyside Don't try and tune the ondemand governor on machines that don't use it --- diff --git a/cookbooks/hardware/attributes/default.rb b/cookbooks/hardware/attributes/default.rb index 414983b84..bc7d773cb 100644 --- a/cookbooks/hardware/attributes/default.rb +++ b/cookbooks/hardware/attributes/default.rb @@ -37,3 +37,9 @@ if File.exist?("/proc/xen") elsif node[:kernel][:modules].include?("i6300esb") default[:hardware][:watchdog] = "none" end + +if File.read("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor").chomp == "ondemand" + default[:sysfs][:cpufreq_ondemand][:comment] = "Tune the ondemand CPU frequency governor" + default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/up_threshold"] = "25" + default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/sampling_down_factor"] = "100" +end diff --git a/cookbooks/hardware/metadata.rb b/cookbooks/hardware/metadata.rb index a702ae0c6..717719572 100644 --- a/cookbooks/hardware/metadata.rb +++ b/cookbooks/hardware/metadata.rb @@ -11,3 +11,4 @@ depends "git" depends "munin" depends "ohai" depends "tools" +depends "sysfs" diff --git a/roles/base.rb b/roles/base.rb index 63c763af1..aa4c8e944 100644 --- a/roles/base.rb +++ b/roles/base.rb @@ -74,15 +74,6 @@ default_attributes( "net.core.default_qdisc" => "pfifo_fast" } } - }, - :sysfs => { - :cpufreq_ondemand => { - :comment => "Tune the ondemand CPU frequency governor", - :parameters => { - "devices/system/cpu/cpufreq/ondemand/up_threshold" => "25", - "devices/system/cpu/cpufreq/ondemand/sampling_down_factor" => "100" - } - } } )