Re: [PATCH 08/10] jump label v11: x86 support

From: Ingo Molnar
Date: Tue Sep 21 2010 - 11:30:27 EST



* Jason Baron <jbaron@xxxxxxxxxx> wrote:

> On Mon, Sep 20, 2010 at 07:43:16PM -0700, H. Peter Anvin wrote:
> > On 09/17/2010 08:09 AM, Jason Baron wrote:
> > > add x86 support for jump label. I'm keeping this patch separate so its clear to
> > > arch maintainers what was required for x86 support this new feature. hopefully,
> > > it wouldn't be too painful for other arches.
> >
> > > + select HAVE_ARCH_JUMP_LABEL if !CC_OPTIMIZE_FOR_SIZE
> >
> > Why?
> >
> > -hpa
> >
>
> Hi,
>
> >From the documentation patch:
>
> " The optimization depends on !CC_OPTIMIZE_FOR_SIZE. When
> CC_OPTIMIZE_FOR_SIZE is set, gcc does not always out of line the not
> taken label path in the same way that the "if unlikely()" paths are
> made out of line. Thus, with CC_OPTIMIZE_FOR_SIZE set, this
> optimization is not always optimal. This may be solved in subsequent
> gcc versions, that allow us to move labels out of line, while still
> optimizing for size. "

OTOH making a difficult optimization (HAVE_ARCH_JUMP_LABEL) dependent on
compiler flags is really asking for trouble.

So how about enabling it unconditionally, and just chalk up the cost
under CC_OPTIMIZE_FOR_SIZE as one of the costs it already has? This also
has the advantage that future compilers can improve things without
having to wait for yet another kernel patch that re-enables
HAVE_ARCH_JUMP_LABEL.

Thanks,

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