Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964934AbbENSRN (ORCPT ); Thu, 14 May 2015 14:17:13 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:33059 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932576AbbENSRM (ORCPT ); Thu, 14 May 2015 14:17:12 -0400 Date: Thu, 14 May 2015 20:17:07 +0200 From: Ingo Molnar To: Denys Vlasenko Cc: "Paul E. McKenney" , Linus Torvalds , Jason Low , Peter Zijlstra , Davidlohr Bueso , Tim Chen , Aswin Chandramouleeswaran , LKML , Borislav Petkov , Andy Lutomirski , Brian Gerst , "H. Peter Anvin" , Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH] x86: Align jump targets to 1 byte boundaries Message-ID: <20150514181707.GA21728@gmail.com> References: <20150409183926.GM6464@linux.vnet.ibm.com> <20150410090051.GA28549@gmail.com> <20150410091252.GA27630@gmail.com> <20150410092152.GA21332@gmail.com> <20150410111427.GA30477@gmail.com> <20150410112748.GB30477@gmail.com> <20150410120846.GA17101@gmail.com> <55548E12.6020207@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55548E12.6020207@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2537 Lines: 75 * Denys Vlasenko 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/