[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200311142321.3zfyoemzvheo4omt@e107158-lin.cambridge.arm.com>
Date: Wed, 11 Mar 2020 14:23:21 +0000
From: Qais Yousef <qais.yousef@....com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Pavan Kondeti <pkondeti@...eaurora.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 6/6] sched/rt: Fix pushing unfit tasks to a better CPU
On 03/11/20 10:00, Steven Rostedt wrote:
> On Mon, 2 Mar 2020 13:27:21 +0000
> Qais Yousef <qais.yousef@....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;
Indeed.
We might have a better fix now if [1] goes in.
It'd fix the 'thundering herd' issue I mentioned before.
cpumask_any_and_distribute() should teach find_lowest_rq() to distribute tasks
that wakeup at the same time better. Hence fix the need to do the above.
It won't be bullet proof still, but neither the above is.
I'm sure there will be other places that can benefit from this distribution
function too.
Thanks!
--
Qais Yousef
[1] https://lore.kernel.org/lkml/20200311010113.136465-1-joshdon@google.com/
Powered by blists - more mailing lists