Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755279AbbDKNtD (ORCPT ); Sat, 11 Apr 2015 09:49:03 -0400 Received: from ud10.udmedia.de ([194.117.254.50]:41099 "EHLO mail.ud10.udmedia.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754196AbbDKNtB (ORCPT ); Sat, 11 Apr 2015 09:49:01 -0400 Date: Sat, 11 Apr 2015 15:48:57 +0200 From: Markus Trippelsdorf To: Denys Vlasenko Cc: Ingo Molnar , "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: <20150411134857.GA31416@x4> 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> <5527C700.3030405@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5527C700.3030405@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1358 Lines: 35 On 2015.04.10 at 14:50 +0200, Denys Vlasenko wrote: > New-ish versions of gcc allow people to specify optimization > options per function: > > https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes > > optimize > The optimize attribute is used to specify that a function is to be compiled > with different optimization options than specified on the command line. > Arguments can either be numbers or strings. Numbers are assumed to be an > optimization level. Strings that begin with O are assumed to be an > optimization option, while other options are assumed to be used with > a -f prefix. > > How about not aligning code by default, and using > > #define hot_func __attribute__((optimize("O2","align-functions=16","align-jumps=16"))) > ... > > void hot_func super_often_called_func(...) {...} > > in hot code paths? __attribute__((optimize)) is meant for compiler debugging only (to help folks to reduce their testcases to a single function). It should _not_ be used in production code, because the implementation is very buggy. -- Markus -- 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/