lkml.org 
[lkml]   [2015]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] x86: Align jump targets to 1 byte boundaries

    * Denys Vlasenko <dvlasenk@redhat.com> wrote:

    > > What do you guys think about this? I think we should seriously
    > > consider relaxing our alignment defaults.
    >
    > Looks like nobody objected. I think it's ok to submit
    > this patch for real.

    Yeah, so my plan is to apply the following three changes from that
    discussion:

    --- tip.orig/arch/x86/Makefile
    +++ tip/arch/x86/Makefile
    @@ -77,6 +77,15 @@ else
    KBUILD_AFLAGS += -m64
    KBUILD_CFLAGS += -m64

    + # Pack jump targets tightly, don't align them to the default 16 bytes:
    + KBUILD_CFLAGS += -falign-jumps=1
    +
    + # Pack functions tightly as well:
    + KBUILD_CFLAGS += -falign-functions=1
    +
    + # Pack loops tightly as well:
    + KBUILD_CFLAGS += -falign-loops=1
    +
    # Don't autogenerate traditional x87 instructions
    KBUILD_CFLAGS += $(call cc-option,-mno-80387)
    KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)
    ... and not do -fno-guess-branch-probability, because it destroys
    likely()/unlikely() annotations.

    Which is a pity, considering the size effect on defconfig:

    text data bss dec filename
    12566383 1617840 1089536 15273759 vmlinux.expect=10 [==vanilla]
    11923529 1617840 1089536 14630905 vmlinux.-fno-guess-branch-probability
    11903663 1617840 1089536 14611039 vmlinux.align=1
    11646102 1617840 1089536 14353478 vmlinux.align=1+fno-guess-branch-probability

    I.e. 2.6% of savings on top of the above three patches, while the
    effect of our hot/cold branch annotations is only around 0.4%, so if
    GCC preserved our annotations under -fno-guess-branch-probability we'd
    be good by at least 2%.

    But GCC doesn't.

    There were also these other changes I tested:

    + # Reduces vmlinux size by 0.25%:
    + KBUILD_CFLAGS += -fno-caller-saves
    +
    + # Reduces vmlinux size by 1.10%:
    + KBUILD_CFLAGS += -fno-inline-small-functions
    +
    + # Reduces vmlinux size by about 0.95%:
    + KBUILD_CFLAGS += -fno-tree-ch

    We could maybe consider -fno-caller-saves. What do you think about
    that option?

    -fno-inline-small-functions is probably a bad idea, and -fno-tree-ch
    is probably a bad idea as well and is a dangerously rare option in any
    case that could break in unexpected ways.

    Thanks,

    Ingo


    \
     
     \ /
      Last update: 2015-05-14 20:41    [W:10.449 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site