lkml.org 
[lkml]   [2020]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 6/6] sched/rt: Fix pushing unfit tasks to a better CPU
On Mon,  2 Mar 2020 13:27:21 +0000
Qais Yousef <qais.yousef@arm.com> wrote:

> + * Don't bother moving it if the destination CPU is
> + * not running a lower priority task.
> + */
> + if (p->prio < cpu_rq(target)->rt.highest_prio.curr) {
> +
> + cpu = target;
> +
> + } else if (p->prio == cpu_rq(target)->rt.highest_prio.curr) {
> +
> + /*
> + * If the priority is the same and the new CPU
> + * is a better fit, then move, otherwise don't
> + * bother here either.
> + */
> + if (fit_target)
> + cpu = target;
> + }

BTW, A little better algorithm would be to test fit_target first:

target_prio = cpu_rq(target)->rt.hightest_prio.curr;
if (p->prio < target_prio) {
cpu = target;

} else if (fit_target && p->prio == target_prio) {
cpu = target;
}

Which can also just be a single if statement:

if (p->prio < target_prio ||
(fit_target && p->prio == target_prio)
cpu = target;

-- Steve

\
 
 \ /
  Last update: 2020-03-11 15:01    [W:0.168 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site