Re: 20% performance drop on PostgreSQL 9.2 from kernel 3.5.3 to 3.6-rc5 on AMD chipsets - bisected

Peter Zijlstra
2012-09-24T16:13:10Z

On Mon, 2012-09-24 at 08:52 -0700, Linus Torvalds wrote:
> And the whole "if we find any non-idle cpu, skip the whole domain"
> logic really seems a bit odd (that's not new to your patch, though).
> Can somebody explain what the whole point of that idiotically written
> function is?

So we're looking for an idle cpu around @target. We prefer a cpu of an
idle core, since SMT-siblings share L[12] cache. The way we do this is
by iterating the topology tree downwards starting at the LLC (L3) cache
level. Its groups are either the SMT-siblings or singleton groups.

In case its the SMT things, we want to skip if there's a non-idle cpu in
that mask to avoid sharing L[12].

If we don't find an empty core, we go down the domain tree, either
finding a NULL domain and terminating, or finding the SMT domain, and
we'll see if there's an idle SMT sibling.

Is it pretty?, not really. Is there a better way of doing it?, possibly,
I just haven't thought of it yet :/