Re: [PATCH 00/10] jump label: introduce very_[un]likely + cleanups+ docs

From: H. Peter Anvin
Date: Wed Feb 22 2012 - 13:28:47 EST


On 02/22/2012 09:14 AM, Richard Henderson wrote:
> On 02/22/12 07:32, Peter Zijlstra wrote:
>> So I clicked the link Jason provided in his 10/10 Documentation patch
>> and stumbled upon:
>>
>> http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01558.html
>>
>> Where rth suggests that __attribute__((hot,cold)) might work on the
>> destination labels. Trying this my compiler (4.6.1+crap) pukes all over
>> me suggesting this isn't (yet) implemented.
>>
>> Richard, is something like that still on the table?
>
> It's still a possibility. I gave Jason a patch for that quite some time
> ago; I don't recall hearing whether it turned out to actually be useful.
>

Hi Richard,

One issue we also have is with the jmp;jmp problem... which
fundamentally comes from the following issue:

when asm goto() is used without a fallthrough (a __builtin_unreachable()
immediately after it, only possible in gcc 4.6.1+) then gcc assumes that
it can reorder the successor blocks arbitrarily, since it has to "jump
anyway". This eliminates the very useful optimization of replacing the
jump with a NOP in the common case.

The alternative, having a fallthrough, means that if gcc has to jump
anyway, then you end up with a jump to a jump, even if the first of
those jumps can usually be nullified.

I talked to H.J. about this, and he suggested that we'd do something
like "assume the first label in the asm goto is the preferred
fallthrough." I never got around to writing up an RFE bugzilla on this,
but do you have any feelings about how useful this would be?

-hpa


--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

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