Don't try and tune the ondemand governor on machines that don't use it
authorTom Hughes <tom@compton.nu>
Fri, 29 Mar 2019 09:00:32 +0000 (09:00 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 29 Mar 2019 09:15:20 +0000 (09:15 +0000)
cookbooks/hardware/attributes/default.rb
cookbooks/hardware/metadata.rb
roles/base.rb

index 414983b84c644420ca738f67adae6786d9be339d..bc7d773cba30179493552b03744203a2ba30257c 100644 (file)
@@ -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
index a702ae0c6e7fc79fe92903a189f26babbe24fbe5..71771957285373bd6b06da840591a9b44dcacebc 100644 (file)
@@ -11,3 +11,4 @@ depends           "git"
 depends           "munin"
 depends           "ohai"
 depends           "tools"
+depends           "sysfs"
index 63c763af109c7467984c3454fa44a9c392a1e187..aa4c8e94472ae29cfd0a72bd130fd31ac693e522 100644 (file)
@@ -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"
-      }
-    }
   }
 )