Lines Matching refs:tunables
119 struct interactive_tunables *tunables; member
172 list_for_each_entry(__ip, &tunables->attr_set.policy_list, tunables_hook)
180 static inline void update_slack_delay(struct interactive_tunables *tunables) in update_slack_delay() argument
182 tunables->timer_slack_delay = usecs_to_jiffies(tunables->timer_slack + in update_slack_delay()
183 tunables->sampling_rate); in update_slack_delay()
189 struct interactive_tunables *tunables = ipolicy->tunables; in timer_slack_required() local
191 if (tunables->timer_slack == 0) in timer_slack_required()
202 struct interactive_tunables *tunables = icpu->ipolicy->tunables; in gov_slack_timer_start() local
204 icpu->slack_timer.expires = jiffies + tunables->timer_slack_delay; in gov_slack_timer_start()
210 struct interactive_tunables *tunables = icpu->ipolicy->tunables; in gov_slack_timer_modify() local
212 mod_timer(&icpu->slack_timer, jiffies + tunables->timer_slack_delay); in gov_slack_timer_modify()
218 struct interactive_tunables *tunables = icpu->ipolicy->tunables; in slack_timer_resched() local
225 tunables->io_is_busy); in slack_timer_resched()
240 freq_to_above_hispeed_delay(struct interactive_tunables *tunables, in freq_to_above_hispeed_delay() argument
247 spin_lock_irqsave(&tunables->above_hispeed_delay_lock, flags); in freq_to_above_hispeed_delay()
249 for (i = 0; i < tunables->nabove_hispeed_delay - 1 && in freq_to_above_hispeed_delay()
250 freq >= tunables->above_hispeed_delay[i + 1]; i += 2) in freq_to_above_hispeed_delay()
253 ret = tunables->above_hispeed_delay[i]; in freq_to_above_hispeed_delay()
254 spin_unlock_irqrestore(&tunables->above_hispeed_delay_lock, flags); in freq_to_above_hispeed_delay()
259 static unsigned int freq_to_targetload(struct interactive_tunables *tunables, in freq_to_targetload() argument
266 spin_lock_irqsave(&tunables->target_loads_lock, flags); in freq_to_targetload()
268 for (i = 0; i < tunables->ntarget_loads - 1 && in freq_to_targetload()
269 freq >= tunables->target_loads[i + 1]; i += 2) in freq_to_targetload()
272 ret = tunables->target_loads[i]; in freq_to_targetload()
273 spin_unlock_irqrestore(&tunables->target_loads_lock, flags); in freq_to_targetload()
293 tl = freq_to_targetload(icpu->ipolicy->tunables, freq); in choose_freq()
357 struct interactive_tunables *tunables = icpu->ipolicy->tunables; in update_load() local
360 now_idle = get_cpu_idle_time(cpu, &now, tunables->io_is_busy); in update_load()
380 struct interactive_tunables *tunables = icpu->ipolicy->tunables; in eval_target_freq() local
402 tunables->boosted = tunables->boost || in eval_target_freq()
403 now < tunables->boostpulse_endtime; in eval_target_freq()
405 if (cpu_load >= tunables->go_hispeed_load || tunables->boosted) { in eval_target_freq()
406 if (policy->cur < tunables->hispeed_freq) { in eval_target_freq()
407 new_freq = tunables->hispeed_freq; in eval_target_freq()
411 if (new_freq < tunables->hispeed_freq) in eval_target_freq()
412 new_freq = tunables->hispeed_freq; in eval_target_freq()
416 if (new_freq > tunables->hispeed_freq && in eval_target_freq()
417 policy->cur < tunables->hispeed_freq) in eval_target_freq()
418 new_freq = tunables->hispeed_freq; in eval_target_freq()
422 if (now < tunables->touchboostpulse_endtime && in eval_target_freq()
423 new_freq < tunables->touchboost_freq) { in eval_target_freq()
424 new_freq = tunables->touchboost_freq; in eval_target_freq()
427 if (policy->cur >= tunables->hispeed_freq && in eval_target_freq()
429 now - icpu->pol_hispeed_val_time < freq_to_above_hispeed_delay(tunables, policy->cur)) { in eval_target_freq()
447 if (now - max_fvtime < tunables->min_sample_time) { in eval_target_freq()
462 if (!tunables->boosted || new_freq > tunables->hispeed_freq) { in eval_target_freq()
513 sampling_rate = icpu->ipolicy->tunables->sampling_rate; in cpufreq_interactive_idle_end()
622 static void cpufreq_interactive_boost(struct interactive_tunables *tunables) in cpufreq_interactive_boost() argument
631 tunables->boosted = true; in cpufreq_interactive_boost()
650 if (icpu->target_freq < tunables->hispeed_freq) { in cpufreq_interactive_boost()
651 icpu->target_freq = tunables->hispeed_freq; in cpufreq_interactive_boost()
756 struct interactive_tunables *tunables = to_tunables(attr_set); \
757 return sprintf(buf, type "\n", tunables->file_name); \
762 struct interactive_tunables *tunables = to_tunables(attr_set); in show_target_loads() local
767 spin_lock_irqsave(&tunables->target_loads_lock, flags); in show_target_loads()
769 for (i = 0; i < tunables->ntarget_loads; i++) in show_target_loads()
770 ret += sprintf(buf + ret, "%u%s", tunables->target_loads[i], in show_target_loads()
774 spin_unlock_irqrestore(&tunables->target_loads_lock, flags); in show_target_loads()
782 struct interactive_tunables *tunables = to_tunables(attr_set); in store_target_loads() local
791 spin_lock_irqsave(&tunables->target_loads_lock, flags); in store_target_loads()
792 if (tunables->target_loads != default_target_loads) in store_target_loads()
793 kfree(tunables->target_loads); in store_target_loads()
794 tunables->target_loads = new_target_loads; in store_target_loads()
795 tunables->ntarget_loads = ntokens; in store_target_loads()
796 spin_unlock_irqrestore(&tunables->target_loads_lock, flags); in store_target_loads()
804 struct interactive_tunables *tunables = to_tunables(attr_set); in show_above_hispeed_delay() local
809 spin_lock_irqsave(&tunables->above_hispeed_delay_lock, flags); in show_above_hispeed_delay()
811 for (i = 0; i < tunables->nabove_hispeed_delay; i++) in show_above_hispeed_delay()
813 tunables->above_hispeed_delay[i], in show_above_hispeed_delay()
817 spin_unlock_irqrestore(&tunables->above_hispeed_delay_lock, flags); in show_above_hispeed_delay()
825 struct interactive_tunables *tunables = to_tunables(attr_set); in store_above_hispeed_delay() local
834 spin_lock_irqsave(&tunables->above_hispeed_delay_lock, flags); in store_above_hispeed_delay()
835 if (tunables->above_hispeed_delay != default_above_hispeed_delay) in store_above_hispeed_delay()
836 kfree(tunables->above_hispeed_delay); in store_above_hispeed_delay()
837 tunables->above_hispeed_delay = new_above_hispeed_delay; in store_above_hispeed_delay()
838 tunables->nabove_hispeed_delay = ntokens; in store_above_hispeed_delay()
839 spin_unlock_irqrestore(&tunables->above_hispeed_delay_lock, flags); in store_above_hispeed_delay()
847 struct interactive_tunables *tunables = to_tunables(attr_set); in store_hispeed_freq() local
855 tunables->hispeed_freq = val; in store_hispeed_freq()
863 struct interactive_tunables *tunables = to_tunables(attr_set); in store_go_hispeed_load() local
871 tunables->go_hispeed_load = val; in store_go_hispeed_load()
879 struct interactive_tunables *tunables = to_tunables(attr_set); in store_min_sample_time() local
887 tunables->min_sample_time = val; in store_min_sample_time()
894 struct interactive_tunables *tunables = to_tunables(attr_set); in show_timer_rate() local
896 return sprintf(buf, "%lu\n", tunables->sampling_rate); in show_timer_rate()
902 struct interactive_tunables *tunables = to_tunables(attr_set); in store_timer_rate() local
915 tunables->sampling_rate = val_round; in store_timer_rate()
923 struct interactive_tunables *tunables = to_tunables(attr_set); in store_timer_slack() local
931 tunables->timer_slack = val; in store_timer_slack()
932 update_slack_delay(tunables); in store_timer_slack()
940 struct interactive_tunables *tunables = to_tunables(attr_set); in store_boost() local
948 tunables->boost = val; in store_boost()
950 if (tunables->boost) { in store_boost()
952 if (!tunables->boosted) in store_boost()
953 cpufreq_interactive_boost(tunables); in store_boost()
955 tunables->boostpulse_endtime = ktime_to_us(ktime_get()); in store_boost()
965 struct interactive_tunables *tunables = to_tunables(attr_set); in store_boostpulse() local
973 tunables->boostpulse_endtime = ktime_to_us(ktime_get()) + in store_boostpulse()
974 tunables->boostpulse_duration; in store_boostpulse()
976 if (!tunables->boosted) in store_boostpulse()
977 cpufreq_interactive_boost(tunables); in store_boostpulse()
985 struct interactive_tunables *tunables = to_tunables(attr_set); in store_boostpulse_duration() local
993 tunables->boostpulse_duration = val; in store_boostpulse_duration()
1001 struct interactive_tunables *tunables = to_tunables(attr_set); in store_io_is_busy() local
1009 tunables->io_is_busy = val; in store_io_is_busy()
1092 struct interactive_tunables *tunables = ipolicy->tunables; in update_util_handler() local
1105 if ((s64)delta_ns < tunables->sampling_rate * NSEC_PER_USEC) in update_util_handler()
1109 icpu->next_sample_jiffies = usecs_to_jiffies(tunables->sampling_rate) + in update_util_handler()
1171 struct interactive_tunables *tunables; in interactive_tunables_alloc() local
1173 tunables = kzalloc(sizeof(*tunables), GFP_KERNEL); in interactive_tunables_alloc()
1174 if (!tunables) in interactive_tunables_alloc()
1177 gov_attr_set_init(&tunables->attr_set, &ipolicy->tunables_hook); in interactive_tunables_alloc()
1179 global_tunables = tunables; in interactive_tunables_alloc()
1181 ipolicy->tunables = tunables; in interactive_tunables_alloc()
1183 return tunables; in interactive_tunables_alloc()
1186 static void interactive_tunables_free(struct interactive_tunables *tunables) in interactive_tunables_free() argument
1191 kfree(tunables); in interactive_tunables_free()
1205 struct interactive_tunables *tunables; in cpufreq_interactive_input_event() local
1224 tunables = pcpu->ipolicy->tunables; in cpufreq_interactive_input_event()
1225 if (!tunables) { in cpufreq_interactive_input_event()
1230 endtime = now + tunables->touchboostpulse_duration_val; in cpufreq_interactive_input_event()
1231 if (endtime < (tunables->touchboostpulse_endtime + in cpufreq_interactive_input_event()
1236 tunables->touchboostpulse_endtime = endtime; in cpufreq_interactive_input_event()
1239 if (pcpu->target_freq < tunables->touchboost_freq) { in cpufreq_interactive_input_event()
1240 pcpu->target_freq = tunables->touchboost_freq; in cpufreq_interactive_input_event()
1247 pcpu->floor_freq = tunables->touchboost_freq; in cpufreq_interactive_input_event()
1346 struct interactive_tunables *tunables = ipolicy->tunables; in rockchip_cpufreq_policy_init() local
1350 tunables->min_sample_time = 40 * USEC_PER_MSEC; in rockchip_cpufreq_policy_init()
1351 tunables->boostpulse_duration = 40 * USEC_PER_MSEC; in rockchip_cpufreq_policy_init()
1353 tunables->hispeed_freq = 1008000; in rockchip_cpufreq_policy_init()
1354 tunables->touchboostpulse_duration_val = 500 * USEC_PER_MSEC; in rockchip_cpufreq_policy_init()
1355 tunables->touchboost_freq = 1200000; in rockchip_cpufreq_policy_init()
1357 tunables->hispeed_freq = 816000; in rockchip_cpufreq_policy_init()
1362 backup_tunables[index] = *tunables; in rockchip_cpufreq_policy_init()
1364 attr_set = tunables->attr_set; in rockchip_cpufreq_policy_init()
1365 *tunables = backup_tunables[index]; in rockchip_cpufreq_policy_init()
1366 tunables->attr_set = attr_set; in rockchip_cpufreq_policy_init()
1374 struct interactive_tunables *tunables; in cpufreq_interactive_init() local
1394 ipolicy->tunables = global_tunables; in cpufreq_interactive_init()
1401 tunables = interactive_tunables_alloc(ipolicy); in cpufreq_interactive_init()
1402 if (!tunables) { in cpufreq_interactive_init()
1407 tunables->hispeed_freq = policy->max; in cpufreq_interactive_init()
1408 tunables->above_hispeed_delay = default_above_hispeed_delay; in cpufreq_interactive_init()
1409 tunables->nabove_hispeed_delay = in cpufreq_interactive_init()
1411 tunables->go_hispeed_load = DEFAULT_GO_HISPEED_LOAD; in cpufreq_interactive_init()
1412 tunables->target_loads = default_target_loads; in cpufreq_interactive_init()
1413 tunables->ntarget_loads = ARRAY_SIZE(default_target_loads); in cpufreq_interactive_init()
1414 tunables->min_sample_time = DEFAULT_MIN_SAMPLE_TIME; in cpufreq_interactive_init()
1415 tunables->boostpulse_duration = DEFAULT_MIN_SAMPLE_TIME; in cpufreq_interactive_init()
1416 tunables->sampling_rate = DEFAULT_SAMPLING_RATE; in cpufreq_interactive_init()
1417 tunables->timer_slack = DEFAULT_TIMER_SLACK; in cpufreq_interactive_init()
1418 update_slack_delay(tunables); in cpufreq_interactive_init()
1420 spin_lock_init(&tunables->target_loads_lock); in cpufreq_interactive_init()
1421 spin_lock_init(&tunables->above_hispeed_delay_lock); in cpufreq_interactive_init()
1428 ret = kobject_init_and_add(&tunables->attr_set.kobj, in cpufreq_interactive_init()
1451 interactive_tunables_free(tunables); in cpufreq_interactive_init()
1465 struct interactive_tunables *tunables = ipolicy->tunables; in cpufreq_interactive_exit() local
1480 count = gov_attr_set_put(&tunables->attr_set, &ipolicy->tunables_hook); in cpufreq_interactive_exit()
1485 backup_tunables[0] = *tunables; in cpufreq_interactive_exit()
1487 backup_tunables[1] = *tunables; in cpufreq_interactive_exit()
1489 interactive_tunables_free(tunables); in cpufreq_interactive_exit()