From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753442AbbDJTXo (ORCPT ); Fri, 10 Apr 2015 15:23:44 -0400 Received: from www62.your-server.de ([213.133.104.62]:36544 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751796AbbDJTXm (ORCPT ); Fri, 10 Apr 2015 15:23:42 -0400 Message-ID: <55282327.6070607@iogearbox.net> Date: Fri, 10 Apr 2015 21:23:19 +0200 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Denys Vlasenko , Ingo Molnar , "Paul E. McKenney" CC: 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 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> <5527C700.3030405@redhat.com> In-Reply-To: <5527C700.3030405@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/10/2015 02:50 PM, 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"))) I stumbled over that some time ago in a different context. Apparently, that's being considered broken by gcc folks [1]. ;) [1] http://gcc.gnu.org/ml/gcc/2012-07/msg00211.html