pass: gov: Modify timer interval setting mechanism 89/116789/5
authorWook Song <wook16.song@samsung.com>
Tue, 28 Feb 2017 08:15:11 +0000 (17:15 +0900)
committerWook Song <wook16.song@samsung.com>
Thu, 9 Mar 2017 05:32:35 +0000 (14:32 +0900)
This patch modifies the timer setting mechanism for the governor to
select either the level-specific timer interval or the default one. The
default timer interval is used when the gov_timeout does not appear in
the Level section of the resource configuration file.

Change-Id: Id1b9d31a3249846ee59b34d00cb41f126440f5bc
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov.c
src/pass/pass-parser.c

index 27d72d69aebf3fceb17e200d6acb08dda71ab948..d7d359c018c1a5338fd9457a9e3214947042e178 100644 (file)
@@ -251,7 +251,7 @@ static int pass_governor_change_level(struct pass_policy *policy, int new_level)
        limit_max_freq = table[new_level].limit_max_freq;
        limit_min_freq = table[new_level].limit_min_freq;
 
-       policy->prev_level = policy->curr_level;
+       policy->prev_level = curr_level;
        policy->curr_level = new_level;
 
        /* Turn on/off CPUs according the maximum number of online CPU */
@@ -372,6 +372,7 @@ static Eina_Bool pass_governor_core_timer(void *data)
 {
        struct pass_policy *policy = (struct pass_policy *)data;
        static int count = 0;
+       double curr_gov_timeout, next_gov_timeout;
        int level;
        int ret;
 
@@ -402,6 +403,9 @@ static Eina_Bool pass_governor_core_timer(void *data)
        /* Calculate the number of busy cpu */
        pass_calculate_busy_cpu(policy);
 
+       /* Store current governor timeout */
+       curr_gov_timeout = policy->pass_table[policy->curr_level].gov_timeout;
+
        /* Determine the amount of proper resource */
        if (policy->governor->governor) {
                level = policy->governor->governor(policy);
@@ -413,21 +417,16 @@ static Eina_Bool pass_governor_core_timer(void *data)
                return ECORE_CALLBACK_CANCEL;
        }
 
-       /*
-        * Change the period of govenor timer according to PASS level
-        */
-       if (policy->pass_table[level].gov_timeout >= PASS_MIN_GOV_TIMEOUT &&
-               (policy->gov_timeout
-                != policy->pass_table[level].gov_timeout)) {
+       /* Store next governor timeout */
+       next_gov_timeout = policy->pass_table[policy->curr_level].gov_timeout;
 
+       /* Change the period of govenor timer according to PASS level */
+       if (curr_gov_timeout != next_gov_timeout) {
                _I("Change the period of governor timer from %fs to %fs\n",
-                               policy->gov_timeout,
-                               policy->pass_table[level].gov_timeout);
-
-               policy->gov_timeout =
-                       policy->pass_table[level].gov_timeout;
+                               curr_gov_timeout,
+                               next_gov_timeout);
                ecore_timer_interval_set(policy->gov_timer_id,
-                                       policy->gov_timeout);
+                               next_gov_timeout);
                ecore_timer_reset(policy->gov_timer_id);
        }
 
@@ -476,6 +475,7 @@ static void __pass_governor_start(struct pass_policy *policy)
        policy->curr_level = -1;
        if (policy->init_level > policy->max_level)
                policy->init_level = policy->max_level;
+
        pass_governor_change_level(policy, policy->init_level);
 
        /* Set PASS state as PASS_GOV_START */
index 6e58f22375bb4bb337bc4be59bf6075fe0dd4338..e953c884dd8dee3ec63dea828076a252c5d267de 100644 (file)
@@ -308,6 +308,7 @@ int pass_get_table(struct pass_policy *policy, char *pass_conf_path)
        policy->up_threshold = 0;
        policy->down_threshold = 0;
        policy->init_level = 0;
+       policy->prev_level = policy->init_level;
        policy->level_up_threshold = 0;
        policy->gov_timeout = 0;
        policy->last_time = 0;