Re: [PATCH RFC V2 3/5] jump_label: if a key has already been initialized, don't nop it out

Steven Rostedt
2011-10-06T19:28:43Z

On Thu, 2011-10-06 at 11:50 -0700, Richard Henderson wrote:
> On 10/06/2011 11:26 AM, Steven Rostedt wrote:
>
> >
> > That jmp to l_yes should easily be a two byte jump.
>
> Until the compiler decides to re-order the code. That's the problem --
> in the general case you do not know how far away the destination is really
> going to be.

Yeah, I was discussing this with Peter Zijlstra on IRC.

>
> There are a couple of possibilities for improvement:
>
> (1) Do as Jason suggests above and let the assembler figure out the size
> of the branch that is needed. Without adding more data to __jump_table,
> you'll want to be extremely careful about checking the two pointers to
> see what size branch has been installed.

Yeah, that could be done at patch time.

>
> (2) Always reserve 5 bytes of space, but if the distance is small enough
> patch in a 2-byte jump. That doesn't help with the icache footprint.

I don't think this one is worth it.

-- Steve