From cffc7aecb03353e6344ec397122a79e9a45f8f8b Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 2 Nov 2017 15:32:00 +0900 Subject: [PATCH] pass: Change name of 'struct pass_table' to 'struct pass_level' PASS used the 'Level' expression which indicates the basic unit. The modules of PASS decide the next level and then resource-controller module set the h/w resource according to the decided level. Prior to that, PASS used the 'struct pass_table' name. It is not correct and make the confusion possible. So, this patch changes the name of 'struct pass_table' to 'struct pass_level'. Change-Id: If0df603dbaf98aa22aad49af15636cd67b35692a Signed-off-by: Chanwoo Choi --- src/pass/pass-gov-radiation.c | 54 +++++----- src/pass/pass-gov-step.c | 36 +++---- src/pass/pass-gov.c | 16 +-- src/pass/pass-parser.c | 180 +++++++++++++++++----------------- src/pass/pass-rescon.c | 8 +- src/pass/pass.c | 8 +- src/pass/pass.h | 6 +- 7 files changed, 154 insertions(+), 154 deletions(-) diff --git a/src/pass/pass-gov-radiation.c b/src/pass/pass-gov-radiation.c index a4e7455..ca78474 100644 --- a/src/pass/pass-gov-radiation.c +++ b/src/pass/pass-gov-radiation.c @@ -36,7 +36,7 @@ */ int pass_radiation_governor(struct pass_policy *policy) { - struct pass_table *table = policy->pass_table; + struct pass_level *levels = policy->levels; struct pass_cpu_stats *cpu_stats = policy->pass_cpu_stats; int up_threshold = policy->up_threshold; int down_threshold = policy->down_threshold; @@ -78,92 +78,92 @@ int pass_radiation_governor(struct pass_policy *policy) */ /* Check level up condition */ - for (j = 0; j < table[level].num_up_cond && up_condition; j++) { - if (table[level].up_cond[j].freq && - !(freq >= table[level].up_cond[j].freq)) + for (j = 0; j < levels[level].num_up_cond && up_condition; j++) { + if (levels[level].up_cond[j].freq && + !(freq >= levels[level].up_cond[j].freq)) up_condition = false; } - if (table[level].num_up_cond && up_condition) { + if (levels[level].num_up_cond && up_condition) { up_count++; /* _I("[Level%d] [up_count : %2d] \ freq(%d), nr_running(%d), busy_cpu(%d)", level, up_count, - table[level].up_cond[j].freq ? freq : -1, + levels[level].up_cond[j].freq ? freq : -1, */ } /* Check level down condition */ - for (j = 0; j < table[level].num_down_cond && down_condition; j++) { - if (table[level].down_cond[j].freq - && !(freq <= table[level].down_cond[j].freq)) + for (j = 0; j < levels[level].num_down_cond && down_condition; j++) { + if (levels[level].down_cond[j].freq + && !(freq <= levels[level].down_cond[j].freq)) down_condition = false; } - if (table[level].num_down_cond && down_condition) { + if (levels[level].num_down_cond && down_condition) { down_count++; /* _I("[Level%d] [dw_count : %2d] \ freq(%d), nr_running(%d), busy_cpu(%d)", level, down_count, - table[level].down_cond[j].freq ? freq : -1, + levels[level].down_cond[j].freq ? freq : -1, */ } /* Check level right condition */ - for (j = 0; j < table[level].num_right_cond && right_condition; j++) { + for (j = 0; j < levels[level].num_right_cond && right_condition; j++) { /* * If one more conditions are false among following * conditions, don't increment right_count. */ - if (table[level].right_cond[j].nr_running - && !(nr_running > table[level].right_cond[j].nr_running)) + if (levels[level].right_cond[j].nr_running + && !(nr_running > levels[level].right_cond[j].nr_running)) right_condition = false; - if (table[level].right_cond[j].busy_cpu - && !(busy_cpu >= table[level].right_cond[j].busy_cpu)) + if (levels[level].right_cond[j].busy_cpu + && !(busy_cpu >= levels[level].right_cond[j].busy_cpu)) right_condition = false; } - if (table[level].num_right_cond && right_condition) { + if (levels[level].num_right_cond && right_condition) { right_count++; /* _I("[Level%d] [right_count : %2d] \ nr_running(%d), busy_cpu(%d)", level, right_count, - table[level].right_cond[j].nr_running ? nr_running : -1, - table[level].right_cond[j].busy_cpu ? busy_cpu : -1); + levels[level].right_cond[j].nr_running ? nr_running : -1, + levels[level].right_cond[j].busy_cpu ? busy_cpu : -1); */ } /* Check level left condition */ - for (j = 0; j < table[level].num_left_cond && left_condition; j++) { + for (j = 0; j < levels[level].num_left_cond && left_condition; j++) { /* * If one more conditions are false among following * conditions, don't increment left_count. */ - if (table[level].left_cond[j].nr_running - && !(nr_running <= table[level].left_cond[j].nr_running)) + if (levels[level].left_cond[j].nr_running + && !(nr_running <= levels[level].left_cond[j].nr_running)) left_condition = false; - if (table[level].left_cond[j].busy_cpu - && !(busy_cpu < table[level].left_cond[j].busy_cpu)) + if (levels[level].left_cond[j].busy_cpu + && !(busy_cpu < levels[level].left_cond[j].busy_cpu)) left_condition = false; } - if (table[level].num_left_cond && left_condition) { + if (levels[level].num_left_cond && left_condition) { left_count++; /* _I("[Level%d] [ left_count : %2d] \ nr_running(%d), busy_cpu(%d)", level, left_count, - table[level].left_cond[j].nr_running ? nr_running : -1, - table[level].left_cond[j].busy_cpu ? busy_cpu : -1); + levels[level].left_cond[j].nr_running ? nr_running : -1, + levels[level].left_cond[j].busy_cpu ? busy_cpu : -1); */ } } diff --git a/src/pass/pass-gov-step.c b/src/pass/pass-gov-step.c index ccbc583..f34882d 100644 --- a/src/pass/pass-gov-step.c +++ b/src/pass/pass-gov-step.c @@ -36,7 +36,7 @@ */ int pass_step_governor(struct pass_policy *policy) { - struct pass_table *table = policy->pass_table; + struct pass_level *levels = policy->levels; struct pass_cpu_stats *cpu_stats = policy->pass_cpu_stats; int up_threshold = policy->up_threshold; int down_threshold = policy->down_threshold; @@ -68,57 +68,57 @@ int pass_step_governor(struct pass_policy *policy) num_pass_gov++; /* Check level up condition */ - for (j = 0; j < table[level].num_up_cond; j++) { + for (j = 0; j < levels[level].num_up_cond; j++) { /* * If one more conditions are false among following * conditions, don't increment up_count. */ - if (freq >= table[level].up_cond[j].freq - && nr_running >= table[level].up_cond[j].nr_running - && busy_cpu >= table[level].up_cond[j].busy_cpu) + if (freq >= levels[level].up_cond[j].freq + && nr_running >= levels[level].up_cond[j].nr_running + && busy_cpu >= levels[level].up_cond[j].busy_cpu) up_condition = true; } - if (table[level].num_up_cond && up_condition) { + if (levels[level].num_up_cond && up_condition) { up_count++; /* _I("[Level%d] [up_count : %2d] \ freq(%d), nr_running(%d), busy_cpu(%d)", level, up_count, - table[level].up_cond[0].freq ? freq : -1, - table[level].up_cond[0].nr_running ? nr_running : -1, - table[level].up_cond[0].busy_cpu ? busy_cpu : -1); + levels[level].up_cond[0].freq ? freq : -1, + levels[level].up_cond[0].nr_running ? nr_running : -1, + levels[level].up_cond[0].busy_cpu ? busy_cpu : -1); */ } /* Check level down condition */ - for (j = 0; j < table[level].num_down_cond; j++) { + for (j = 0; j < levels[level].num_down_cond; j++) { /* * If one more conditions are false among following * conditions, don't increment down_count. */ - if (freq <= table[level].down_cond[j].freq - && nr_running < table[level].down_cond[j].nr_running - && busy_cpu < table[level].down_cond[j].busy_cpu) + if (freq <= levels[level].down_cond[j].freq + && nr_running < levels[level].down_cond[j].nr_running + && busy_cpu < levels[level].down_cond[j].busy_cpu) down_condition = true; } - if (table[level].num_down_cond && down_condition) { + if (levels[level].num_down_cond && down_condition) { down_count++; /* _I("[Level%d] [dw_count : %2d] \ freq(%d), nr_running(%d), busy_cpu(%d)", level, down_count, - table[level].down_cond[0].freq ? freq : -1, - table[level].down_cond[0].nr_running ? nr_running : -1, - table[level].down_cond[0].busy_cpu ? busy_cpu : -1); + levels[level].down_cond[0].freq ? freq : -1, + levels[level].down_cond[0].nr_running ? nr_running : -1, + levels[level].down_cond[0].busy_cpu ? busy_cpu : -1); */ } if (level < policy->max_level && - freq == table[level].limit_max_freq) + freq == levels[level].limit_max_freq) up_max_count++; } diff --git a/src/pass/pass-gov.c b/src/pass/pass-gov.c index 25586b6..f7e71f9 100644 --- a/src/pass/pass-gov.c +++ b/src/pass/pass-gov.c @@ -100,20 +100,20 @@ static int pass_notifier_exit(struct pass_policy *policy) */ static void pass_hotplug_stop(struct pass_policy *policy) { - struct pass_table *table = policy->pass_table; + struct pass_level *levels = policy->levels; int level = policy->max_level; - if (!policy->hotplug || !table) + if (!policy->hotplug || !levels) return; - policy->hotplug->online = table[level].limit_min_cpu; + policy->hotplug->online = levels[level].limit_min_cpu; } static int pass_hotplug_dummy_governor(struct pass_policy *policy) { int level = policy->curr_level; - return policy->pass_table[level].limit_min_cpu; + return policy->levels[level].limit_min_cpu; } /* @@ -164,7 +164,7 @@ static void pass_calculate_busy_cpu(struct pass_policy *policy) { struct pass_cpu_stats *stats = policy->pass_cpu_stats; struct pass_resource *res = to_pass_resource(policy); - struct pass_table *table = policy->pass_table; + struct pass_level *levels = policy->levels; struct pass_conf_data *cdata = &res->cdata; unsigned int level = policy->curr_level; unsigned int cpu_threshold = 0; @@ -178,7 +178,7 @@ static void pass_calculate_busy_cpu(struct pass_policy *policy) int i; int j; - limit_min_cpu = table[level].limit_min_cpu; + limit_min_cpu = levels[level].limit_min_cpu; for (i = 0; i < policy->num_pass_cpu_stats; i++) { cur_freq = stats[i].freq; @@ -262,7 +262,7 @@ static gboolean pass_governor_timeout_cb(gpointer data) pass_calculate_busy_cpu(policy); /* Store current governor timeout */ - curr_gov_timeout = policy->pass_table[policy->curr_level].gov_timeout; + curr_gov_timeout = policy->levels[policy->curr_level].gov_timeout; /* Determine the amount of proper resource */ if (policy->governor->governor) { @@ -276,7 +276,7 @@ static gboolean pass_governor_timeout_cb(gpointer data) } /* Get the governor timeout interval for the next */ - next_gov_timeout = policy->pass_table[policy->curr_level].gov_timeout; + next_gov_timeout = policy->levels[policy->curr_level].gov_timeout; /* * Change the governor timeout interval when the next interval is not diff --git a/src/pass/pass-parser.c b/src/pass/pass-parser.c index aa7c94e..bf58e1f 100644 --- a/src/pass/pass-parser.c +++ b/src/pass/pass-parser.c @@ -133,58 +133,58 @@ static int pass_parse_level(struct parse_result *result, * - PASS_RESOURCE_GPU_ID */ if (MATCH(result->name, "limit_max_freq")) - policy->pass_table[level].limit_max_freq = atoi(result->value); + policy->levels[level].limit_max_freq = atoi(result->value); else if (MATCH(result->name, "limit_min_freq")) - policy->pass_table[level].limit_min_freq = atoi(result->value); + policy->levels[level].limit_min_freq = atoi(result->value); else if (MATCH(result->name, "limit_min_cpu")) - policy->pass_table[level].limit_min_cpu = atoi(result->value); + policy->levels[level].limit_min_cpu = atoi(result->value); /* * Properties for the following h/w resources: * - PASS_RESOURCE_CPU_ID */ else if (MATCH(result->name, "num_down_cond")) - policy->pass_table[level].num_down_cond = atoi(result->value); + policy->levels[level].num_down_cond = atoi(result->value); else if (MATCH(result->name, "num_down_cond_freq")) - policy->pass_table[level].down_cond[0].freq = atoi(result->value); + policy->levels[level].down_cond[0].freq = atoi(result->value); else if (MATCH(result->name, "num_down_cond_nr_running")) - policy->pass_table[level].down_cond[0].nr_running = atoi(result->value); + policy->levels[level].down_cond[0].nr_running = atoi(result->value); else if (MATCH(result->name, "num_down_cond_busy_cpu")) - policy->pass_table[level].down_cond[0].busy_cpu = atoi(result->value); + policy->levels[level].down_cond[0].busy_cpu = atoi(result->value); else if (MATCH(result->name, "num_up_cond")) - policy->pass_table[level].num_up_cond = atoi(result->value); + policy->levels[level].num_up_cond = atoi(result->value); else if (MATCH(result->name, "num_up_cond_freq")) - policy->pass_table[level].up_cond[0].freq = atoi(result->value); + policy->levels[level].up_cond[0].freq = atoi(result->value); else if (MATCH(result->name, "num_up_cond_nr_running")) - policy->pass_table[level].up_cond[0].nr_running = atoi(result->value); + policy->levels[level].up_cond[0].nr_running = atoi(result->value); else if (MATCH(result->name, "num_up_cond_busy_cpu")) - policy->pass_table[level].up_cond[0].busy_cpu = atoi(result->value); + policy->levels[level].up_cond[0].busy_cpu = atoi(result->value); else if (MATCH(result->name, "num_left_cond")) - policy->pass_table[level].num_left_cond = atoi(result->value); + policy->levels[level].num_left_cond = atoi(result->value); else if (MATCH(result->name, "num_left_cond_freq")) - policy->pass_table[level].left_cond[0].freq = atoi(result->value); + policy->levels[level].left_cond[0].freq = atoi(result->value); else if (MATCH(result->name, "num_left_cond_nr_running")) - policy->pass_table[level].left_cond[0].nr_running = atoi(result->value); + policy->levels[level].left_cond[0].nr_running = atoi(result->value); else if (MATCH(result->name, "num_left_cond_busy_cpu")) - policy->pass_table[level].left_cond[0].busy_cpu = atoi(result->value); + policy->levels[level].left_cond[0].busy_cpu = atoi(result->value); else if (MATCH(result->name, "num_right_cond")) - policy->pass_table[level].num_right_cond = atoi(result->value); + policy->levels[level].num_right_cond = atoi(result->value); else if (MATCH(result->name, "num_right_cond_freq")) - policy->pass_table[level].right_cond[0].freq = atoi(result->value); + policy->levels[level].right_cond[0].freq = atoi(result->value); else if (MATCH(result->name, "num_right_cond_nr_running")) - policy->pass_table[level].right_cond[0].nr_running = atoi(result->value); + policy->levels[level].right_cond[0].nr_running = atoi(result->value); else if (MATCH(result->name, "num_right_cond_busy_cpu")) - policy->pass_table[level].right_cond[0].busy_cpu = atoi(result->value); + policy->levels[level].right_cond[0].busy_cpu = atoi(result->value); else if (MATCH(result->name, "gov_timeout")) { double gov_timeout = atof(result->value); if (gov_timeout < PASS_MIN_GOV_TIMEOUT) gov_timeout = PASS_MIN_GOV_TIMEOUT; - policy->pass_table[level].gov_timeout = gov_timeout; + policy->levels[level].gov_timeout = gov_timeout; } /* @@ -192,7 +192,7 @@ static int pass_parse_level(struct parse_result *result, * - PASS_RESOURCE_MEMORY_ID */ else if (MATCH(result->name, "fault_around_bytes")) - policy->pass_table[level].fault_around_bytes = atoi(result->value); + policy->levels[level].fault_around_bytes = atoi(result->value); return 0; } @@ -242,11 +242,11 @@ static int pass_parse_core(struct parse_result *result, void *user_data) policy->gov_timeout = PASS_MIN_GOV_TIMEOUT; } - if (policy->num_levels > 0 && !policy->pass_table) { - policy->pass_table = calloc(policy->num_levels, - sizeof(struct pass_table)); - if (!policy->pass_table) { - _E("cannot allocate memory for pass_table\n"); + if (policy->num_levels > 0 && !policy->levels) { + policy->levels = calloc(policy->num_levels, + sizeof(struct pass_level)); + if (!policy->levels) { + _E("cannot allocate memory for levels\n"); return -EINVAL; } } @@ -384,83 +384,83 @@ int pass_get_table(struct pass_policy *policy, char *pass_conf_path) for (level = 0; level < policy->num_levels; level++) { _I("================================================\n"); - if (policy->pass_table[level].limit_max_freq) - _I("%s| policy->pass_table[%d].limit_max_freq : %d\n", + if (policy->levels[level].limit_max_freq) + _I("%s| policy->levels[%d].limit_max_freq : %d\n", res->cdata.res_name, level, - policy->pass_table[level].limit_max_freq); - if (policy->pass_table[level].limit_min_freq) - _I("%s| policy->pass_table[%d].limit_min_freq : %d\n", + policy->levels[level].limit_max_freq); + if (policy->levels[level].limit_min_freq) + _I("%s| policy->levels[%d].limit_min_freq : %d\n", res->cdata.res_name, level, - policy->pass_table[level].limit_min_freq); - if (policy->pass_table[level].limit_min_cpu) - _I("%s| policy->pass_table[%d].limit_min_cpu : %d\n", + policy->levels[level].limit_min_freq); + if (policy->levels[level].limit_min_cpu) + _I("%s| policy->levels[%d].limit_min_cpu : %d\n", res->cdata.res_name, level, - policy->pass_table[level].limit_min_cpu); - if (policy->pass_table[level].gov_timeout) - _I("%s| policy->pass_table[%d].gov_timeout : %f\n", + policy->levels[level].limit_min_cpu); + if (policy->levels[level].gov_timeout) + _I("%s| policy->levels[%d].gov_timeout : %f\n", res->cdata.res_name, level, - policy->pass_table[level].gov_timeout); + policy->levels[level].gov_timeout); - if (policy->pass_table[level].num_down_cond) - _I("%s| policy->pass_table[%d].num_down_cond : %d\n", + if (policy->levels[level].num_down_cond) + _I("%s| policy->levels[%d].num_down_cond : %d\n", res->cdata.res_name, level, - policy->pass_table[level].num_down_cond); - if (policy->pass_table[level].down_cond[0].freq) - _I("%s| policy->pass_table[%d].down_cond[0].freq : %d\n", + policy->levels[level].num_down_cond); + if (policy->levels[level].down_cond[0].freq) + _I("%s| policy->levels[%d].down_cond[0].freq : %d\n", res->cdata.res_name, level, - policy->pass_table[level].down_cond[0].freq); - if (policy->pass_table[level].down_cond[0].nr_running) - _I("%s| policy->pass_table[%d].down_cond[0].nr_running : %d\n", + policy->levels[level].down_cond[0].freq); + if (policy->levels[level].down_cond[0].nr_running) + _I("%s| policy->levels[%d].down_cond[0].nr_running : %d\n", res->cdata.res_name, level, - policy->pass_table[level].down_cond[0].nr_running); - if (policy->pass_table[level].down_cond[0].busy_cpu) - _I("%s| policy->pass_table[%d].down_cond[0].busy_cpu : %d\n", + policy->levels[level].down_cond[0].nr_running); + if (policy->levels[level].down_cond[0].busy_cpu) + _I("%s| policy->levels[%d].down_cond[0].busy_cpu : %d\n", res->cdata.res_name, level, - policy->pass_table[level].down_cond[0].busy_cpu); + policy->levels[level].down_cond[0].busy_cpu); - if (policy->pass_table[level].num_up_cond) - _I("%s| policy->pass_table[%d].num_up_cond : %d\n", + if (policy->levels[level].num_up_cond) + _I("%s| policy->levels[%d].num_up_cond : %d\n", res->cdata.res_name, level, - policy->pass_table[level].num_up_cond); - if (policy->pass_table[level].up_cond[0].freq) - _I("%s| policy->pass_table[%d].up_cond[0].freq : %d\n", + policy->levels[level].num_up_cond); + if (policy->levels[level].up_cond[0].freq) + _I("%s| policy->levels[%d].up_cond[0].freq : %d\n", res->cdata.res_name, level, - policy->pass_table[level].up_cond[0].freq); - if (policy->pass_table[level].up_cond[0].nr_running) - _I("%s| policy->pass_table[%d].up_cond[0].nr_running : %d\n", + policy->levels[level].up_cond[0].freq); + if (policy->levels[level].up_cond[0].nr_running) + _I("%s| policy->levels[%d].up_cond[0].nr_running : %d\n", res->cdata.res_name, level, - policy->pass_table[level].up_cond[0].nr_running); - if (policy->pass_table[level].up_cond[0].busy_cpu) - _I("%s| policy->pass_table[%d].up_cond[0].busy_cpu : %d\n", + policy->levels[level].up_cond[0].nr_running); + if (policy->levels[level].up_cond[0].busy_cpu) + _I("%s| policy->levels[%d].up_cond[0].busy_cpu : %d\n", res->cdata.res_name, level, - policy->pass_table[level].up_cond[0].busy_cpu); + policy->levels[level].up_cond[0].busy_cpu); - if (policy->pass_table[level].num_left_cond) - _I("%s| policy->pass_table[%d].num_left_cond : %d\n", + if (policy->levels[level].num_left_cond) + _I("%s| policy->levels[%d].num_left_cond : %d\n", res->cdata.res_name, level, - policy->pass_table[level].num_left_cond); - if (policy->pass_table[level].left_cond[0].freq) - _I("%s| policy->pass_table[%d].left_cond[0].freq : %d\n", - res->cdata.res_name, level, policy->pass_table[level].left_cond[0].freq); - if (policy->pass_table[level].left_cond[0].nr_running) - _I("%s| policy->pass_table[%d].left_cond[0].nr_running : %d\n", - res->cdata.res_name, level, policy->pass_table[level].left_cond[0].nr_running); - if (policy->pass_table[level].left_cond[0].busy_cpu) - _I("%s| policy->pass_table[%d].left_cond[0].busy_cpu : %d\n", - res->cdata.res_name, level, policy->pass_table[level].left_cond[0].busy_cpu); - - if (policy->pass_table[level].num_right_cond) - _I("%s| policy->pass_table[%d].num_right_cond : %d\n", - res->cdata.res_name, level, policy->pass_table[level].num_right_cond); - if (policy->pass_table[level].right_cond[0].freq) - _I("%s| policy->pass_table[%d].right_cond[0].freq : %d\n", - res->cdata.res_name, level, policy->pass_table[level].right_cond[0].freq); - if (policy->pass_table[level].right_cond[0].nr_running) - _I("%s| policy->pass_table[%d].right_cond[0].nr_running : %d\n", - res->cdata.res_name, level, policy->pass_table[level].right_cond[0].nr_running); - if (policy->pass_table[level].right_cond[0].busy_cpu) - _I("%s| policy->pass_table[%d].right_cond[0].busy_cpu : %d\n", - res->cdata.res_name, level, policy->pass_table[level].right_cond[0].busy_cpu); + policy->levels[level].num_left_cond); + if (policy->levels[level].left_cond[0].freq) + _I("%s| policy->levels[%d].left_cond[0].freq : %d\n", + res->cdata.res_name, level, policy->levels[level].left_cond[0].freq); + if (policy->levels[level].left_cond[0].nr_running) + _I("%s| policy->levels[%d].left_cond[0].nr_running : %d\n", + res->cdata.res_name, level, policy->levels[level].left_cond[0].nr_running); + if (policy->levels[level].left_cond[0].busy_cpu) + _I("%s| policy->levels[%d].left_cond[0].busy_cpu : %d\n", + res->cdata.res_name, level, policy->levels[level].left_cond[0].busy_cpu); + + if (policy->levels[level].num_right_cond) + _I("%s| policy->levels[%d].num_right_cond : %d\n", + res->cdata.res_name, level, policy->levels[level].num_right_cond); + if (policy->levels[level].right_cond[0].freq) + _I("%s| policy->levels[%d].right_cond[0].freq : %d\n", + res->cdata.res_name, level, policy->levels[level].right_cond[0].freq); + if (policy->levels[level].right_cond[0].nr_running) + _I("%s| policy->levels[%d].right_cond[0].nr_running : %d\n", + res->cdata.res_name, level, policy->levels[level].right_cond[0].nr_running); + if (policy->levels[level].right_cond[0].busy_cpu) + _I("%s| policy->levels[%d].right_cond[0].busy_cpu : %d\n", + res->cdata.res_name, level, policy->levels[level].right_cond[0].busy_cpu); } */ @@ -477,9 +477,9 @@ int pass_get_table(struct pass_policy *policy, char *pass_conf_path) void pass_put_table(struct pass_policy *policy) { - if (policy->pass_table) { - free(policy->pass_table); - policy->pass_table = NULL; + if (policy->levels) { + free(policy->levels); + policy->levels = NULL; } if (policy->scenario.list) { diff --git a/src/pass/pass-rescon.c b/src/pass/pass-rescon.c index f1938d2..e6e8a30 100644 --- a/src/pass/pass-rescon.c +++ b/src/pass/pass-rescon.c @@ -73,7 +73,7 @@ int pass_rescon_set_level(struct pass_policy *policy, int new_level) { struct pass_resource *res = to_pass_resource(policy); struct pass_conf_data *cdata = &res->cdata; - struct pass_table *table = policy->pass_table; + struct pass_level *levels = policy->levels; struct pass_hotplug *hotplug = policy->hotplug; int curr_level = policy->curr_level; int limit_max_freq; @@ -92,9 +92,9 @@ int pass_rescon_set_level(struct pass_policy *policy, int new_level) return 0; /* Get the detailed resource value according to PASS level */ - limit_max_freq = table[new_level].limit_max_freq; - limit_min_freq = table[new_level].limit_min_freq; - fault_around_bytes = table[new_level].fault_around_bytes; + limit_max_freq = levels[new_level].limit_max_freq; + limit_min_freq = levels[new_level].limit_min_freq; + fault_around_bytes = levels[new_level].fault_around_bytes; policy->prev_level = curr_level; policy->curr_level = new_level; diff --git a/src/pass/pass.c b/src/pass/pass.c index 2618178..2af60b7 100644 --- a/src/pass/pass.c +++ b/src/pass/pass.c @@ -169,10 +169,10 @@ static int pass_init_resource(struct pass_resource *res) policy->num_pass_cpu_stats = PASS_CPU_STATS_DEFAULT; for (i = 0; i < policy->num_levels; i++) { - if (max_freq < policy->pass_table[i].limit_max_freq) - max_freq = policy->pass_table[i].limit_max_freq; - if (policy->pass_table[i].gov_timeout == 0) - policy->pass_table[i].gov_timeout = policy->gov_timeout; + if (max_freq < policy->levels[i].limit_max_freq) + max_freq = policy->levels[i].limit_max_freq; + if (policy->levels[i].gov_timeout == 0) + policy->levels[i].gov_timeout = policy->gov_timeout; } policy->freq.max_freq = max_freq; diff --git a/src/pass/pass.h b/src/pass/pass.h index 1a81c18..c8a8d70 100644 --- a/src/pass/pass.h +++ b/src/pass/pass.h @@ -149,7 +149,7 @@ struct pass_level_condition { }; /* - * struct pass_table - Represent the PASS's level + * struct pass_level - Represent the PASS's level * * @limit_max_freq: the limited maximum frequency * this property is used for the following resoures: @@ -183,7 +183,7 @@ struct pass_level_condition { * they are valid when governor type is either GOV_RADIATION or GOV_STEP. * - PASS_RESOURCE_CPU_ID */ -struct pass_table { +struct pass_level { /* Properties for the h/w resources */ int limit_max_freq; int limit_min_freq; @@ -277,7 +277,7 @@ struct pass_policy { struct pass_freq_policy freq; struct pass_scenario_policy scenario; - struct pass_table *pass_table; + struct pass_level *levels; struct pass_cpu_stats *pass_cpu_stats; int num_pass_cpu_stats; -- 2.34.1