Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759424Ab0FJPiV (ORCPT ); Thu, 10 Jun 2010 11:38:21 -0400 Received: from mx2.mail.elte.hu ([157.181.151.9]:42147 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751451Ab0FJPiT (ORCPT ); Thu, 10 Jun 2010 11:38:19 -0400 Date: Thu, 10 Jun 2010 17:37:42 +0200 From: Ingo Molnar To: Andi Kleen Cc: Peter Zijlstra , Jason Baron , linux-kernel@vger.kernel.org, mathieu.desnoyers@polymtl.ca, hpa@zytor.com, tglx@linutronix.de, rostedt@goodmis.org, roland@redhat.com, rth@redhat.com, mhiramat@redhat.com, fweisbec@gmail.com, avi@redhat.com, davem@davemloft.net, vgoyal@redhat.com, sam@ravnborg.org, Linus Torvalds , Arjan van de Ven Subject: Re: [PATCH 03/13] jump label v9: x86 support Message-ID: <20100610153742.GA9118@elte.hu> References: <1276171930.2077.200.camel@twins> <20100610121440.GA20130@elte.hu> <20100610132616.GA19561@basil.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100610132616.GA19561@basil.fritz.box> User-Agent: Mutt/1.5.20 (2009-08-17) X-ELTE-SpamScore: -1.1 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.1 required=5.9 tests=BAYES_05 autolearn=no SpamAssassin version=3.2.5 -1.1 BAYES_05 BODY: Bayesian spam probability is 1 to 5% [score: 0.0290] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1873 Lines: 52 * Andi Kleen wrote: > > Hm, we need more than a comment for that - distros enable > > CC_OPTIMIZE_FOR_SIZE all the time, for the massive kernel image (and > > hotpath cache footprint) savings. Is this fixable? > > Actually the big distros (RHEL, SLES) disable it all the time now. [...] Not all the big distros, Fedora certainly doesnt. > [...] It costs you in some benchmarks. [...] Microbenchmarks mostly, see below. > The code generated by -Os is often terrible. But it results in a kernel .text that is ~30% smaller, so considering the fact that most real-life kernel code execution is instruction-cache-cold it's generally a win. But micro-benchmarks are instruction-cache-hot so that's where the pressure to remove the flag comes from. > Nearly everytime I investigate some bad asm code being generated by gcc it > goes away when that flag is disabled. That is not fixing anything, it is working bugs around. > A much better to get smaller kernel images is to do more __cold annotations > for slow paths. Newer gcc will then simply only do -Os for these functions. That's an opt-in method and we cannot reach the kinds of 30% code size reductions that -Os can achieve. Most code in the kernel is not cache-hot, even on microbenchmarks. A much better model would be to actively mark hot codepaths with a __hot attribute instead. Then the code size difference can be considered on a case by case basis. And where GCC produces indefensibly crap code there GCC needs to be fixed. Crap code often increases size so the fix would increase the efficiency of -Os. 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/