Re: [PATCH 1/2] sched/rt.c: pick and check task if double_lock_balance() unlock the rq

From: Steven Rostedt
Date: Thu Apr 12 2018 - 08:10:49 EST


On Thu, 12 Apr 2018 18:58:54 +0800
Li Bin <huawei.libin@xxxxxxxxxx> wrote:

> @@ -1726,13 +1746,10 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
> * We had to unlock the run queue. In
> * the mean time, task could have
> * migrated already or had its affinity changed.
> - * Also make sure that it wasn't scheduled on its rq.
> */
> - if (unlikely(task_rq(task) != rq ||
> - !cpumask_test_cpu(lowest_rq->cpu, &task->cpus_allowed) ||
> - task_running(rq, task) ||
> - !rt_task(task) ||
> - !task_on_rq_queued(task))) {
> + struct task_struct *next_task = pick_next_pushable_task(rq);

Could you declare next_task above the comment. It's better styling.

struct task_struct *next_task;
/*
* Comment
*/
next_task = pick_next_pushable_task(rq);


-- Steve

> + if (unlikely(next_task != task ||
> + !cpumask_test_cpu(lowest_rq->cpu, &task->cpus_allowed))) {
>
> double_unlock_balance(rq, lowest_rq);
> lowest_rq = NULL;
> @@ -1752,26 +1769,6 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)