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

Commit 77ba2b9f authored by Olav Haugan's avatar Olav Haugan Committed by Todd Kjos
Browse files

sched: Update task->on_rq when tasks are moving between runqueues



Task->on_rq has three states:
	0 - Task is not on runqueue (rq)
	1 (TASK_ON_RQ_QUEUED) - Task is on rq
	2 (TASK_ON_RQ_MIGRATING) - Task is on rq but in the
	process of being migrated to another rq

When a task is moving between rqs task->on_rq state should be
TASK_ON_RQ_MIGRATING in order for WALT to account rq's cumulative
runnable average correctly.  Without such state marking for all the
classes, WALT's update_history() would try to fixup task's demand
which was never contributed to any of CPUs during migration.

Change-Id: I65e74a8f176c3ed4b8577577f6da8897ecda7bb8
Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
[joonwoop: Reinforced changelog to explain why this is needed by WALT.
           Fixed conflicts in deadline.c]
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
(cherry picked from commit 0f8791c90a99f718c43ab8214076c0c671a36667)
[fixed cherry-pick issue due to missing fab5cc59bf]
Signed-off-by: default avatarQuentin Perret <quentin.perret@arm.com>
parent 98a5fa3b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1286,7 +1286,9 @@ static void __migrate_swap_task(struct task_struct *p, int cpu)

		p->on_rq = TASK_ON_RQ_MIGRATING;
		deactivate_task(src_rq, p, 0);
		p->on_rq = TASK_ON_RQ_MIGRATING;
		set_task_cpu(p, cpu);
		p->on_rq = TASK_ON_RQ_QUEUED;
		activate_task(dst_rq, p, 0);
		p->on_rq = TASK_ON_RQ_QUEUED;
		check_preempt_curr(dst_rq, p, 0);
+4 −0
Original line number Diff line number Diff line
@@ -1505,7 +1505,9 @@ static int push_dl_task(struct rq *rq)
	}

	deactivate_task(rq, next_task, 0);
	next_task->on_rq = TASK_ON_RQ_MIGRATING;
	set_task_cpu(next_task, later_rq->cpu);
	next_task->on_rq = TASK_ON_RQ_QUEUED;
	activate_task(later_rq, next_task, 0);
	ret = 1;

@@ -1593,7 +1595,9 @@ static void pull_dl_task(struct rq *this_rq)
			resched = true;

			deactivate_task(src_rq, p, 0);
			p->on_rq = TASK_ON_RQ_MIGRATING;
			set_task_cpu(p, this_cpu);
			p->on_rq = TASK_ON_RQ_QUEUED;
			activate_task(this_rq, p, 0);
			dmin = p->dl.deadline;

+4 −0
Original line number Diff line number Diff line
@@ -1897,7 +1897,9 @@ static int push_rt_task(struct rq *rq)
	}

	deactivate_task(rq, next_task, 0);
	next_task->on_rq = TASK_ON_RQ_MIGRATING;
	set_task_cpu(next_task, lowest_rq->cpu);
	next_task->on_rq = TASK_ON_RQ_QUEUED;
	activate_task(lowest_rq, next_task, 0);
	ret = 1;

@@ -2151,7 +2153,9 @@ static void pull_rt_task(struct rq *this_rq)
			resched = true;

			deactivate_task(src_rq, p, 0);
			p->on_rq = TASK_ON_RQ_MIGRATING;
			set_task_cpu(p, this_cpu);
			p->on_rq = TASK_ON_RQ_QUEUED;
			activate_task(this_rq, p, 0);
			/*
			 * We continue with the search, just in