Skip to contentSkip to conversation

cpufreq: allow customization of some parameters

PATCH New Jan Beulich 1 participant 1 message Dec 5, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: allow customization of some parameters

Short of having a way for powersaved to dynamically adjust these values, at least allow specifying them on the command line. In particular, always running at an up-threshold of 80% is perhaps nice for laptop use, but certainly not desirable on servers. On shell scripts invoking large numbers of short-lived processes I noticed a 50% performance degradation on a dual-socket quad-core Barcelona just because of the load of an individual core never crossing the 80% boundary that would have resulted in increasing the frequency.

(Powersaved on SLE10 sets this on native kernels to 60% or 80%, depending on whether performance or power reduction is preferred, *divided* by the number of CPUs, but capped at the lower limit of 20%.)

xen/common/domain.c +11 -1
Index: 2008-11-20/xen/common/domain.c
===================================================================
@@ -25,6 +25,7 @@
 #include <xen/percpu.h>
 #include <xen/multicall.h>
 #include <xen/rcupdate.h>
+#include <acpi/cpufreq/cpufreq.h>
 #include <asm/debugger.h>
 #include <public/sched.h>
 #include <public/vcpu.h>
@@ -41,16 +42,25 @@ boolean_param("dom0_vcpus_pin", opt_dom0
 enum cpufreq_controller cpufreq_controller;
 static void __init setup_cpufreq_option(char *str)
 {
+    char *arg;
+
     if ( !strcmp(str, "dom0-kernel") )
     {
         xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX;
         cpufreq_controller = FREQCTL_dom0_kernel;
         opt_dom0_vcpus_pin = 1;
+        return;
     }
-    else if ( !strcmp(str, "xen") )
+
+    if ( (arg = strpbrk(str, ",:")) != NULL )
+        *arg++ = '\0';
+
+    if ( !strcmp(str, "xen") )
     {
         xen_processor_pmbits |= XEN_PROCESSOR_PM_PX;
         cpufreq_controller = FREQCTL_xen;
+        if ( arg && *arg )
+            cpufreq_cmdline_parse(arg);
     }
 }
 custom_param("cpufreq", setup_cpufreq_option);
xen/drivers/cpufreq/cpufreq_ondemand.c +75 -5

111 lines not on this page · raw message

xen/include/acpi/cpufreq/cpufreq.h +2 -0
Index: 2008-11-20/xen/include/acpi/cpufreq/cpufreq.h
===================================================================
@@ -55,6 +55,8 @@ extern struct cpufreq_policy *cpufreq_cp
 extern int __cpufreq_set_policy(struct cpufreq_policy *data,
                                 struct cpufreq_policy *policy);
 
+void cpufreq_cmdline_parse(char *);
+
 #define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
 #define CPUFREQ_SHARED_TYPE_HW   (1) /* HW does needed coordination */
 #define CPUFREQ_SHARED_TYPE_ALL  (2) /* All dependent CPUs should set freq */