From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751152AbbDLIHR (ORCPT ); Sun, 12 Apr 2015 04:07:17 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:38084 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756AbbDLIHJ (ORCPT ); Sun, 12 Apr 2015 04:07:09 -0400 Date: Sun, 12 Apr 2015 10:07:04 +0200 From: Ingo Molnar To: Thomas Gleixner Cc: Linus Torvalds , Denys Vlasenko , Borislav Petkov , Tim Chen , Andy Lutomirski , Jason Low , Brian Gerst , Aswin Chandramouleeswaran , "Paul E. McKenney" , Davidlohr Bueso , Peter Zijlstra , "H. Peter Anvin" , LKML , Peter Zijlstra Subject: Re: [PATCH] x86: Turn off GCC branch probability heuristics Message-ID: <20150412080704.GC9062@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> <20150411092021.GA9478@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 * Thomas Gleixner wrote: > > How much of that 5% comes from code alignment? Or was this on > > *top* of the 1-byte alignment testt? > > I thinks its just the no-guess one: > > text data dec patch reduction > > 7563475 1781048 10302987 > > 7192973 1780024 9931461 no-guess -4.8% > > 7354819 1781048 958464 align-1 -2.7% > > 7192973 1780024 9931461 no-guess + align-1 -4.8% > > So with the no-guess applied the align-1 does not matter anymore. What kernel config and GCC version did you use? I used x86-64 defconfig+kvmconfig with GCC 4.9.1, and it gave me: text filename reduction 12566383 vmlinux.expect=10 [==vanilla] 11923529 vmlinux.-fno-guess-branch-probability -5.4% 11903663 vmlinux.align=1 -5.6% 11646102 vmlinux.align=1+fno-guess-branch-probability -7.9% So there's still appears to be an additional -2.5% to be gained from turning off GCC branch heuristics. x86 defconfig was derived from a distro kernel config and is still pretty close to what distros typically enable, so it's a good 'typical' config to use for testing. To double check that assumption I also tested a distro kernel .config and looked at vmlinux sizes: text filename reduction 12612201 vmlinux.expect=10 [==vanilla] 12107614 vmlinux.-fno-guess-branch-probability -4.1% 12021817 vmlinux.align=1 -4.9% 11846771 vmlinux.align=1+fno-guess-branch-probability -6.5% this was cloned from a different major Linux distro than the one the original x86 defconfig was derived from - still the vmlinux sizes are pretty similar. So x86 'make defconfig' measurements are pretty representative if you are looking for a quick, independent way to measure 'typical Linux distro' kernel characteristics. ( The only bigger difference is that FUNCTION_TRACER was turned on in the distro config - which bloats function prologues a bit and thus reduces the relative savings a bit. ) Thanks, Ingo