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

Commit 308a623a authored by Wanpeng Li's avatar Wanpeng Li Committed by Ingo Molnar
Browse files

sched/rt: Clean up check_preempt_equal_prio()



This patch checks if current can be pushed/pulled somewhere else
in advance to make logic clear, the same behavior as dl class.

- If current can't be migrated, useless to reschedule, let's hope
  task can move out.
- If task is migratable, so let's not schedule it and see if it
  can be pushed or pulled somewhere else.

Signed-off-by: default avatarWanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414708776-124078-1-git-send-email-wanpeng.li@linux.intel.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 75e23e49
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -1351,16 +1351,22 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)


static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
{
{
	if (rq->curr->nr_cpus_allowed == 1)
	/*
	 * Current can't be migrated, useless to reschedule,
	 * let's hope p can move out.
	 */
	if (rq->curr->nr_cpus_allowed == 1 ||
	    !cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
		return;
		return;


	/*
	 * p is migratable, so let's not schedule it and
	 * see if it is pushed or pulled somewhere else.
	 */
	if (p->nr_cpus_allowed != 1
	if (p->nr_cpus_allowed != 1
	    && cpupri_find(&rq->rd->cpupri, p, NULL))
	    && cpupri_find(&rq->rd->cpupri, p, NULL))
		return;
		return;


	if (!cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
		return;

	/*
	/*
	 * There appears to be other cpus that can accept
	 * There appears to be other cpus that can accept
	 * current and none to run 'p', so lets reschedule
	 * current and none to run 'p', so lets reschedule