Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07359763 authored by Vikram Mulukutla's avatar Vikram Mulukutla
Browse files

sched: Fix racy invocation of fixup_busy_time via move_queued_task



set_task_cpu uses fixup_busy_time to redistribute a task's load
information between source and destination runqueues. fixup_busy_time
assumes that both source and destination runqueue locks have been
acquired if the task is not being concurrently woken up. However
this is no longer true, since move_queued_task does not acquire the
destination CPU's runqueue lock due to optimizations brought in by
recent kernels.

Acquire both source and destination runqueue locks before invoking
set_task_cpu in move_queued_tasks.

Change-Id: I39fadf0508ad42e511db43428e52c8aa8bf9baf6
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent 861a4ae9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6373,7 +6373,9 @@ static struct rq *move_queued_task(struct task_struct *p, int new_cpu)

	dequeue_task(rq, p, DEQUEUE_MIGRATING);
	p->on_rq = TASK_ON_RQ_MIGRATING;
	double_lock_balance(rq, cpu_rq(new_cpu));
	set_task_cpu(p, new_cpu);
	double_unlock_balance(rq, cpu_rq(new_cpu));
	raw_spin_unlock(&rq->lock);

	rq = cpu_rq(new_cpu);