From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755579AbbDKTgB (ORCPT ); Sat, 11 Apr 2015 15:36:01 -0400 Received: from mail-ie0-f176.google.com ([209.85.223.176]:33747 "EHLO mail-ie0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755273AbbDKTf7 (ORCPT ); Sat, 11 Apr 2015 15:35:59 -0400 MIME-Version: 1.0 In-Reply-To: References: <20150409175652.GI6464@linux.vnet.ibm.com> <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> Date: Sat, 11 Apr 2015 12:35:58 -0700 X-Google-Sender-Auth: 7x1p7GoKCxntzhx5kPQFjyDHMgA Message-ID: Subject: Re: [PATCH] x86: Turn off GCC branch probability heuristics From: Linus Torvalds To: Thomas Gleixner , Jakub Jelinek Cc: Ingo Molnar , 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 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 11, 2015 at 11:57 AM, Thomas Gleixner 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. Damn. If it actually honored likely/unlikely, then we should just do it - and manually fix up any places where we really care. But the fact that it apparently entirely disables not just the guesses, but our *explicit* likely/unlikely, means that we can't fix up the mistakes. And in many of the hot codepaths that likely/unlikely really does matter. Some of our hottest paths have known "this basically never happens" situations that we do *not* want to break up our L1 I$ over. There's a number of functions that have been optimized to really generate good code, and "-fno-guess-branch-probability" disables those manual optimizations. So we'd have no way to fix it for the cases that matter. Sad. It might be worth bringing this up with some gcc people. I added Jakub to the cc. Any other gcc people suggestions? Linus