Files
SDK_SG200x_V2/linux_5.10/kernel/sched/cvi_sched.h
carbon 0545e9dc6d init version 2024-05-07
commit d1edce71135cc6d98c0a4b5729774542b676e769
Author: sophgo-forum-service <forum_service@sophgo.com>
Date:   Fri Mar 15 16:07:33 2024 +0800

    [fix] recommend using ssh method to clone repo.
    [fix] fix sensor driver repo branch name.
2024-05-07 19:36:36 +08:00

50 lines
1.5 KiB
C

#ifdef CONFIG_SCHED_CVITEK
struct cvi_priority_info {
char comm[TASK_COMM_LEN];
u32 sched_policy;
u32 sched_priority;
};
static struct cvi_priority_info priority_list[] = {
{ "cvitask_isp_pre", SCHED_FIFO, 90 },
{ "cvitask_isp_pos", SCHED_FIFO, 90 },
{ "cvitask_vc_sb0", SCHED_RR, 99 },
{ "cvitask_vc_wt0", SCHED_RR, 95 },
{ "cvitask_vc_wt1", SCHED_RR, 95 },
{ "cvitask_vc_bh0", SCHED_RR, 95 },
{ "cvitask_vpss_0", SCHED_FIFO, 90 },
{ "cvitask_vpss_1", SCHED_FIFO, 90 },
{ "cvitask_tpu_wor", SCHED_RR, 85 }
};
#define MAX_OPT_RT_PRIORITY 80
static inline void cvi_checkpriority(struct task_struct *p,
struct sched_attr *attr)
{
/*
* Set the priority for the tasks which are in the priority_list automatically.
* In the meantime, we will check the priority if the task is not belong cvitek soc driver,
* modify the priority if it's trying to set scheduler to realtime scheduler and
* priority higher than 80
* to make sure soc driver tasks are able to finish first.
*/
int i = 0;
if (!strncmp(p->comm, "cvitask_", 8)) {
for (i = 0; i < sizeof(priority_list) /
sizeof(struct cvi_priority_info);
i++) {
if (strcmp(priority_list[i].comm, p->comm))
continue;
attr->sched_policy = priority_list[i].sched_policy;
attr->sched_priority = priority_list[i].sched_priority;
break;
}
} else if (attr->sched_policy == SCHED_FIFO ||
attr->sched_policy == SCHED_RR) {
attr->sched_priority =
attr->sched_priority > MAX_OPT_RT_PRIORITY ?
MAX_OPT_RT_PRIORITY :
attr->sched_priority;
}
}
#endif