pass: cpuhp: Remove unnecessary struct pass_freq_policy and level_up_threshold 44/169044/2
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 2 Feb 2018 04:39:40 +0000 (13:39 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 2 Feb 2018 05:09:57 +0000 (14:09 +0900)
Remove unnecessary struct pass_freq_policy and level_up_threshold.
Instead, add max_freq which contains the maximum frequency among PASS's levels
to struct pass_cpuhp. The max_freq is used to calculate the busy cpu on CPUHP's
governor.

Change-Id: I3cab9c13baa927cf0ecd5a9220ba8ab8c8db30dd
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-cpuhp.c
src/pass/pass-parser.c
src/pass/pass.h

index 3a45909..a863ad6 100644 (file)
@@ -146,7 +146,7 @@ static void cpuhp_calculate_busy_cpu(struct pass_resource *res)
 
                        cpu_threshold =
                                (unsigned int)(cur_freq * load)
-                                               / cpuhp->freq.max_freq;
+                                               / cpuhp->max_freq;
                        if (load == 100
                                || cpu_threshold >= cpuhp->pass_cpu_threshold)
                                busy_cpu++;
@@ -353,7 +353,6 @@ static int cpuhp_governor_exit(struct pass_resource *res)
        cpuhp->pass_cpu_threshold = 0;
        cpuhp->up_threshold = 0;
        cpuhp->down_threshold = 0;
-       cpuhp->level_up_threshold = 0;
        cpuhp->num_pass_cpu_stats = 0;
        cpuhp->governor = NULL;
 
@@ -461,17 +460,13 @@ int pass_cpuhp_init(struct pass_resource *res)
        if (!cpuhp->down_threshold)
                cpuhp->down_threshold = PASS_DEFAULT_LEVEL_DOWN_THRESHOLD;
 
-       if (!cpuhp->level_up_threshold)
-               cpuhp->level_up_threshold = 0;
-
        if (!cpuhp->num_pass_cpu_stats)
                cpuhp->num_pass_cpu_stats = PASS_CPU_STATS_MAX_COUNT;
 
        for (i = 0; i < res->config_data.num_levels; i++)
                if (max_freq < res->config_data.levels[i].limit_max_freq)
                        max_freq = res->config_data.levels[i].limit_max_freq;
-       cpuhp->freq.max_freq = max_freq;
-
+       cpuhp->max_freq = max_freq;
 
        /* Allocate memory according to the number of data and cpu */
        cpuhp->pass_cpu_stats = calloc(cpuhp->num_pass_cpu_stats,
index 7fdadbc..911a188 100644 (file)
@@ -258,8 +258,6 @@ static int parse_core(struct parse_result *result, void *user_data)
                res->cpuhp.up_threshold = atoi(result->value);
        else if (MATCH(result->name, "pass_down_threshold"))
                res->cpuhp.down_threshold = atoi(result->value);
-       else if (MATCH(result->name, "pass_level_up_threshold"))
-               res->cpuhp.level_up_threshold = atoi(result->value);
        else if (MATCH(result->name, "pass_governor_timeout")) {
                res->config_data.gov_timeout = atof(result->value);
 
@@ -573,7 +571,6 @@ int pass_get_each_resource_config(struct pass_resource *res, char *path)
        cpuhp->pass_cpu_threshold = 0;
        cpuhp->up_threshold = 0;
        cpuhp->down_threshold = 0;
-       cpuhp->level_up_threshold = 0;
        cpuhp->last_time = 0;
 
        /* Initialize the PMQoS's data */
index d465e33..55f4fbb 100644 (file)
@@ -89,12 +89,6 @@ struct pass_hotplug {
        int (*governor)(struct pass_resource *res);
 };
 
-struct pass_freq_policy {
-       unsigned int max_freq;
-       unsigned int sampling_rate;
-       unsigned int up_threshold;
-};
-
 struct pass_level_condition {
        int freq;
        int nr_running;
@@ -248,10 +242,9 @@ struct pass_pmqos {
  * @last_time: the updated last time of cpu_stats
  * @governor: the instance of CPUHP Policy governor.
  * @gov_timeout_id: the periodic timer id
+ * @max_freq: the maximum frequency among levels
  *
  * @hotplug: the instance of CPU Hotplug governor (will be deprecated).
- * @freq: store cpufreq's variables (will be deprecated).
- * @level_up_threshold: threshold used when changing level (will be deprecated).
  *
  * CPUHP may be o enabled or disabled according to configuration file setting.
  */
@@ -270,9 +263,9 @@ struct pass_cpuhp {
        struct pass_cpuhp_governor *governor;
        guint gov_timeout_id;
 
+       unsigned int max_freq;
+
        struct pass_hotplug *hotplug;
-       struct pass_freq_policy freq;
-       unsigned int level_up_threshold;
 };
 
 /******************************************************