Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751388AbbDLH4T (ORCPT ); Sun, 12 Apr 2015 03:56:19 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:37385 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbbDLH4S (ORCPT ); Sun, 12 Apr 2015 03:56:18 -0400 Message-ID: <1428825371.3479.11.camel@gmail.com> Subject: Re: [PATCH] x86: Turn off GCC branch probability heuristics From: Mike Galbraith To: Ingo Molnar Cc: Linus Torvalds , Thomas Gleixner , Jakub Jelinek , 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 Date: Sun, 12 Apr 2015 09:56:11 +0200 In-Reply-To: <20150412054747.GA9062@gmail.com> References: <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> <20150412054747.GA9062@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.0 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2632 Lines: 72 On Sun, 2015-04-12 at 07:47 +0200, Ingo Molnar wrote: > * Linus Torvalds wrote: > > > On Sat, Apr 11, 2015 at 11:57 AM, Thomas Gleixner < > > tglx@linutronix.de> wrote: > > > > > > 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% > > > > Yeah, a 5% code expansion is a big deal. Sadly, it looks like > > 'no-guess' also disables our explicit likely/unlikely handling. > > So I spent some time trying to get as much code size reduction as > possible via GCC optimization options, and the total savings > possible > are 10.1%: > > text data bss dec filename > 12566391 1617840 1089536 15273767 vmlinux.vanilla > 11416805 1617840 1089536 14124181 vmlinux.combo > 10532552 1596080 1089536 13218168 vmlinux.Os > > (combo patch attached below.) > > The -Os savings are 19% total - but as you mentioned before, it's > sometimes achieved through unacceptable techniques. > > Unfortunately I found no other GCC options to achieve what -Os does - > > the missing 9% can purely be achieved via -Os, with no cherry- > picking > possible. > > The other, smaller savings are: > > + # 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 > > (each of them has to be double checked to make sure it leads to > nothing silly and unacceptable - I just blindly tried to find GCC > options that impacted kernel code size.) Ew, my i4790 really hated this patch. taskset 0xc pipe-test 1 avg 733.2 727.1 743.1 746.6 737.1 737 KHz 1.000 -gcc_twiddle 713.7 717.9 715.5 718.0 708.7 714 KHz .968 +gcc_twiddle tbench.sh 8 30 3566.14 3560.91 3566.35 3556.57 3549.69 3559.93 MB/S 1.000 -gcc_twiddle 2862.18 2899.51 2888.74 2897.18 2878.63 2885.25 MB/S .810 +gcc_twiddle -Mike -- 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/