Re: sched: Avoid SMT siblings in select_idle_sibling() if possible

From: Mike Galbraith
Date: Wed Nov 16 2011 - 04:24:24 EST


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

--
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/