ll_schedule: refine the task->state update

Updates the task->state to reflect the real task status and only do
necessary check in schedule_ll_is_pending().

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This commit is contained in:
Keyon Jie 2021-06-30 17:11:14 +08:00 committed by Liam Girdwood
parent 9d84c1510c
commit dd0635c015
1 changed files with 11 additions and 0 deletions

View File

@ -72,6 +72,14 @@ static bool schedule_ll_is_pending(struct ll_schedule_data *sch)
list_for_item(tlist, &sch->tasks) {
task = container_of(tlist, struct task, list);
/*
* only tasks queued or waiting for reschedule are
* pending for scheduling
*/
if (task->state != SOF_TASK_STATE_QUEUED &&
task->state != SOF_TASK_STATE_RESCHEDULE)
continue;
if (domain_is_pending(domain, task, &sched_comp)) {
task->state = SOF_TASK_STATE_PENDING;
pending_count++;
@ -126,6 +134,8 @@ static void schedule_ll_tasks_execute(struct ll_schedule_data *sch)
tr_dbg(&ll_tr, "task %p %pU being started...", task, task->uid);
task->state = SOF_TASK_STATE_RUNNING;
task->state = task_run(task);
spin_lock(&domain->lock);
@ -435,6 +445,7 @@ static int schedule_ll_task(void *data, struct task *task, uint64_t start,
/* insert task into the list */
schedule_ll_task_insert(task, &sch->tasks);
task->state = SOF_TASK_STATE_QUEUED;
/* set schedule domain */
ret = schedule_ll_domain_set(sch, task, start, period);