Skip to contentSkip to conversation

misc cpufreq cleanup

PATCH New Jan Beulich 1 participant 1 message May 3, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc cpufreq cleanup

- proper handling of governor command line options when using the default governor
- warning message for unrecognized command line options
- replacing a NR_CPUS sized array with per-CPU data
- a couple of __read_mostly annotations

xen/drivers/cpufreq/cpufreq.c +10 -6
@@ -47,7 +47,8 @@
 #include <acpi/acpi.h>
 #include <acpi/cpufreq/cpufreq.h>
 
-static unsigned int usr_max_freq, usr_min_freq;
+static unsigned int __read_mostly usr_min_freq;
+static unsigned int __read_mostly usr_max_freq;
 static void cpufreq_cmdline_common_para(struct cpufreq_policy *new_policy);
 
 struct cpufreq_dom {
@@ -55,10 +56,10 @@ struct cpufreq_dom {
     cpumask_t		map;
     struct list_head	node;
 };
-static LIST_HEAD(cpufreq_dom_list_head);
+static LIST_HEAD_READ_MOSTLY(cpufreq_dom_list_head);
 
-struct cpufreq_governor *cpufreq_opt_governor;
-LIST_HEAD(cpufreq_governor_list);
+struct cpufreq_governor *__read_mostly cpufreq_opt_governor;
+LIST_HEAD_READ_MOSTLY(cpufreq_governor_list);
 
 bool_t __read_mostly cpufreq_verbose;
 
@@ -525,6 +526,7 @@ void __init cpufreq_cmdline_parse(char *
 {
     static struct cpufreq_governor *__initdata cpufreq_governors[] =
     {
+        CPUFREQ_DEFAULT_GOVERNOR,
         &cpufreq_gov_userspace,
         &cpufreq_gov_dbs,
         &cpufreq_gov_performance,
@@ -558,8 +560,10 @@ void __init cpufreq_cmdline_parse(char *
         }
 
         if (str && !cpufreq_handle_common_option(str, val) &&
-            cpufreq_governors[gov_index]->handle_option)
-            cpufreq_governors[gov_index]->handle_option(str, val);
+            (!cpufreq_governors[gov_index]->handle_option ||
+             !cpufreq_governors[gov_index]->handle_option(str, val)))
+            printk(XENLOG_WARNING "cpufreq/%s: option '%s' not recognized\n",
+                   cpufreq_governors[gov_index]->name, str);
 
         str = end;
     } while (str);
xen/drivers/cpufreq/cpufreq_misc_governors.c +38 -14

105 lines not on this page · raw message

xen/drivers/cpufreq/cpufreq_ondemand.c +4 -1
@@ -296,7 +296,7 @@ int cpufreq_governor_dbs(struct cpufreq_
     return 0;
 }
 
-static void __init cpufreq_dbs_handle_option(const char *name, const char *val)
+static bool_t __init cpufreq_dbs_handle_option(const char *name, const char *val)
 {
     if ( !strcmp(name, "rate") && val )
     {
@@ -334,6 +334,9 @@ static void __init cpufreq_dbs_handle_op
         }
         dbs_tuners_ins.powersave_bias = tmp;
     }
+    else
+        return 0;
+    return 1;
 }
 
 struct cpufreq_governor cpufreq_gov_dbs = {
xen/include/acpi/cpufreq/cpufreq.h +1 -1
@@ -93,7 +93,7 @@ struct cpufreq_governor {
     char    name[CPUFREQ_NAME_LEN];
     int     (*governor)(struct cpufreq_policy *policy,
                         unsigned int event);
-    void    (*handle_option)(const char *name, const char *value);
+    bool_t  (*handle_option)(const char *name, const char *value);
     struct list_head governor_list;
 };
 

- proper handling of governor command line options when using the default governor
- warning message for unrecognized command line options
- replacing a NR_CPUS sized array with per-CPU data
- a couple of __read_mostly annotations

xen/drivers/cpufreq/cpufreq.c +10 -6
@@ -47,7 +47,8 @@
 #include <acpi/acpi.h>
 #include <acpi/cpufreq/cpufreq.h>
 
-static unsigned int usr_max_freq, usr_min_freq;
+static unsigned int __read_mostly usr_min_freq;
+static unsigned int __read_mostly usr_max_freq;
 static void cpufreq_cmdline_common_para(struct cpufreq_policy *new_policy);
 
 struct cpufreq_dom {
@@ -55,10 +56,10 @@ struct cpufreq_dom {
     cpumask_t		map;
     struct list_head	node;
 };
-static LIST_HEAD(cpufreq_dom_list_head);
+static LIST_HEAD_READ_MOSTLY(cpufreq_dom_list_head);
 
-struct cpufreq_governor *cpufreq_opt_governor;
-LIST_HEAD(cpufreq_governor_list);
+struct cpufreq_governor *__read_mostly cpufreq_opt_governor;
+LIST_HEAD_READ_MOSTLY(cpufreq_governor_list);
 
 bool_t __read_mostly cpufreq_verbose;
 
@@ -525,6 +526,7 @@ void __init cpufreq_cmdline_parse(char *
 {
     static struct cpufreq_governor *__initdata cpufreq_governors[] =
     {
+        CPUFREQ_DEFAULT_GOVERNOR,
         &cpufreq_gov_userspace,
         &cpufreq_gov_dbs,
         &cpufreq_gov_performance,
@@ -558,8 +560,10 @@ void __init cpufreq_cmdline_parse(char *
         }
 
         if (str && !cpufreq_handle_common_option(str, val) &&
-            cpufreq_governors[gov_index]->handle_option)
-            cpufreq_governors[gov_index]->handle_option(str, val);
+            (!cpufreq_governors[gov_index]->handle_option ||
+             !cpufreq_governors[gov_index]->handle_option(str, val)))
+            printk(XENLOG_WARNING "cpufreq/%s: option '%s' not recognized\n",
+                   cpufreq_governors[gov_index]->name, str);
 
         str = end;
     } while (str);
xen/drivers/cpufreq/cpufreq_misc_governors.c +38 -14

105 lines not on this page · raw message

xen/drivers/cpufreq/cpufreq_ondemand.c +4 -1
@@ -296,7 +296,7 @@ int cpufreq_governor_dbs(struct cpufreq_
     return 0;
 }
 
-static void __init cpufreq_dbs_handle_option(const char *name, const char *val)
+static bool_t __init cpufreq_dbs_handle_option(const char *name, const char *val)
 {
     if ( !strcmp(name, "rate") && val )
     {
@@ -334,6 +334,9 @@ static void __init cpufreq_dbs_handle_op
         }
         dbs_tuners_ins.powersave_bias = tmp;
     }
+    else
+        return 0;
+    return 1;
 }
 
 struct cpufreq_governor cpufreq_gov_dbs = {
xen/include/acpi/cpufreq/cpufreq.h +1 -1
@@ -93,7 +93,7 @@ struct cpufreq_governor {
     char    name[CPUFREQ_NAME_LEN];
     int     (*governor)(struct cpufreq_policy *policy,
                         unsigned int event);
-    void    (*handle_option)(const char *name, const char *value);
+    bool_t  (*handle_option)(const char *name, const char *value);
     struct list_head governor_list;
 };
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel