Re: sched: Avoid SMT siblings in select_idle_sibling() if possible
From: Suresh Siddha
Date: Wed Nov 16 2011 - 13:34:06 EST
On Wed, 2011-11-16 at 01:24 -0800, Mike Galbraith wrote:
> On Tue, 2011-11-15 at 17:14 -0800, Suresh Siddha wrote:
>
> > How about this patch which is more self explanatory?
>
> Actually, after further testing/reading, it looks to me like both of
> these patches have a problem. They'll never select SMT siblings (so a
> skip SIBLING should accomplish the same).
>
> This patch didn't select an idle core either though, where Peter's did.
>
> Tested by pinning a hog to cores 1-3, then starting up an unpinned
> tbench pair. Peter's patch didn't do the BadThing (as in bad for
> TCP_RR/tbench) in that case, but should have.
>
> > + sg = sd->groups;
> > + do {
> > + if (!cpumask_intersects(sched_group_cpus(sg),
> > + tsk_cpus_allowed(p)))
> > + goto next;
> >
> > + for_each_cpu(i, sched_group_cpus(sg)) {
> > + if (!idle_cpu(i))
> > + goto next;
>
> Say target is CPU0. Groups are 0,4 1,5 2,6 3,7. 0-3 are first CPUs
> encountered in MC groups, all were busy. At SIBLING level, the only
> group is 0,4. First encountered CPU of sole group is busy target, so
> we're done.. so we return busy target.
>
> > + target = cpumask_first_and(sched_group_cpus(sg),
> > + tsk_cpus_allowed(p));
>
> At SIBLING, group = 0,4 = 0x5, 0x5 & 0xff = 1 = target.
Mike, At the sibling level, domain span will be 0,4 which is 0x5. But
there are two individual groups. First group just contains cpu0 and the
second group contains cpu4.
So if cpu0 is busy, we will check the next group to see if it is idle
(which is cpu4 in your example). So we will return cpu-4.
It should be ok. Isn't it?
thanks,
suresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/