return;
}
- find_cpu_boosting_info_in_tables(&cpu_boosting_info, &tid);
-
- switch (cpu_boosting_level) {
- case CPU_BOOSTING_LEVEL_NONE:
- if (cpu_boosting_info == NULL)
- return;
-
- if ((cpu_boosting_flags & CPU_BOOSTING_FORCE_RESET_ON_CLEAR) == 0)
- return;
-
- /**
- * Set only CPU_BOOSTING_FORCE_RESET_ON_CLEAR flag
- * when CPU boosting level is CPU_BOOSTING_LEVEL_NONE.
- * This is because, except for the flag, no other information is correct.
- */
- cpu_boosting_info_set_flag = CPU_BOOSTING_INFO_SET_CPU_BOOSTING_FLAGS;
- set_cpu_boosting_info(cpu_boosting_info_set_flag, cpu_boosting_info,
- 0, 0, cpu_boosting_info->cpu_boosting_flags | CPU_BOOSTING_FORCE_RESET_ON_CLEAR,
- NULL, CPU_BOOSTING_LEVEL_NONE);
- return;
- case CPU_BOOSTING_LEVEL_STRONG:
- case CPU_BOOSTING_LEVEL_MEDIUM:
- case CPU_BOOSTING_LEVEL_WEAK:
- break;
- default:
- _E("Invalid CPU boosting level");
+ /**
+ * If CPU_BOOSTING_FORCE_RESET_ON_SET flag is set,
+ * remove previous cpu boosting info of the thread regardless of CPU boosting level.
+ * This is because, this flag ignores previous cpu boosting set instructions.
+ */
+ if (cpu_boosting_flags & CPU_BOOSTING_FORCE_RESET_ON_SET) {
+ remove_cpu_boosting_info_in_tables(&tid);
return;
}
+ find_cpu_boosting_info_in_tables(&cpu_boosting_info, &tid);
+
cpu_boosting_info_set_flag =
CPU_BOOSTING_INFO_SET_TID | CPU_BOOSTING_INFO_SET_REF_CNT |
CPU_BOOSTING_INFO_SET_CPU_BOOSTING_FLAGS | CPU_BOOSTING_INFO_SET_GSOURCE_ID |
int success_cnt = 0;
uint32_t sched_attr_set_flag;
+ if (cpu_boosting_flags & CPU_BOOSTING_FORCE_RESET_ON_SET)
+ attr = cpu_boosting_attr[CPU_BOOSTING_LEVEL_NONE];
+
if (cpu_boosting_flags & CPU_BOOSTING_RESET_ON_FORK) {
_I("[CPU-BOOSTING] Turn on SCHED_RESET_ON_FORK flag");
int timeout_msec = input->client_input.timeout_msec;
cpu_boosting_level_e cpu_boosting_level = input->client_input.level;
cpu_boosting_flag_e cpu_boosting_flags = input->client_input.flags;
- bool update_cpu_boosting_info = false;
if (!is_valid_cpu_boosting_level(cpu_boosting_level)) {
_E("[CPU-BOOSTING] Unknown boosting level");
*/
switch (cpu_boosting_level) {
case CPU_BOOSTING_LEVEL_NONE:
- update_cpu_boosting_info = true;
- break;
case CPU_BOOSTING_LEVEL_STRONG:
case CPU_BOOSTING_LEVEL_MEDIUM:
case CPU_BOOSTING_LEVEL_WEAK:
update_cpu_sched_of_thread_list(tid_count, tid_list,
cpu_boosting_flags, cpu_boosting_level,
&fail_cnt, &success_cnt);
- if (success_cnt > 0)
- update_cpu_boosting_info = true;
break;
default:
_E("Invalid CPU boosting level");
id = *(input->gsource_id);
}
- }
- if (update_cpu_boosting_info) {
for (int i = 0; i < tid_count; i++) {
if (tid_list[i] <= 0)
continue;
if (cpu_boosting_info == NULL)
return false;
- if (cpu_boosting_info->cpu_boosting_flags & CPU_BOOSTING_FORCE_RESET_ON_CLEAR)
- return true;
-
/**
- * TODO: check count when the CPU_BOOSTING_FORCE_RESET_ON_CLEAR is disabled.
+ * TODO: Check reference count.
*
- * Currently CPU_BOOSTING_COMMAND_CLEAR resets CPU boosting forcely
- * regardless of CPU_BOOSTING_FORCE_RESET_ON_CLEAR flag.
+ * Currently CPU_BOOSTING_COMMAND_CLEAR resets CPU boosting forcely.
* It may cause unintended early termination of CPU boosting.
*/
return true;