Re: [RFC][PATCH 5/7] sched: Rewrite select_idle_siblings()
From: Peter Zijlstra
Date: Wed May 11 2016 - 03:00:54 EST
On Wed, May 11, 2016 at 05:05:50AM +0800, Yuyang Du wrote:
> On Mon, May 09, 2016 at 12:48:12PM +0200, Peter Zijlstra wrote:
> > + i = select_idle_core(p, sd, target);
> > + if ((unsigned)i < nr_cpumask_bits)
> > + return i;
> > +
> > + i = select_idle_cpu(p, sd, target);
> > + if ((unsigned)i < nr_cpumask_bits)
> > + return i;
> > +
> > + i = select_idle_smt(p, sd, target);
> > + if ((unsigned)i < nr_cpumask_bits)
> > + return i;
>
> First, on smt, these three scans have a lot of overlap,
Limited, we stop doing the idle_core scan the moment we fail to find
one. And on a busy system it is unlikely to come back.
Which leaves us with the straight idle_cpu scan. Sure, the one time we
fail to find an idle core and fall through we'll scan double, but that
should be rare.
> Then, I am still considering combining them a bit, like the following patch.
> And if you want, more might be combined.
I tried that (and you really want the last idle it finds, to minimize
the time between testing for idle and returning it), but it didn't
matter for anything I could find.