public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] __cacheline_aligned always in own section
Date: Thu, 26 Feb 2004 19:01:52 -0600	[thread overview]
Message-ID: <20040227010151.GI3883@waste.org> (raw)
In-Reply-To: <20040226152139.5b881a12.akpm@osdl.org>

On Thu, Feb 26, 2004 at 03:21:39PM -0800, Andrew Morton wrote:
> Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua> wrote:
> >
> > I compile my kernels for 486 but buils system aligns
> > functions and labels to 16 bytes, with results like this:
> > 
> > 00000730 <islpci_eth_tx_timeout>:
> >      730:       55                      push   %ebp
> >      731:       89 e5                   mov    %esp,%ebp
> >      733:       8b 45 08                mov    0x8(%ebp),%eax
> >      736:       8b 40 64                mov    0x64(%eax),%eax
> >      739:       05 14 03 00 00          add    $0x314,%eax
> >      73e:       ff 40 14                incl   0x14(%eax)
> >      741:       5d                      pop    %ebp
> >      742:       c3                      ret
> >      743:       90                      nop
> >      744:       90                      nop
> >      745:       90                      nop
> >      746:       90                      nop
> >      747:       90                      nop
> >      748:       90                      nop
> >      749:       90                      nop
> >      74a:       90                      nop
> >      74b:       90                      nop
> >      74c:       90                      nop
> >      74d:       90                      nop
> >      74e:       90                      nop
> >      74f:       90                      nop
> > 
> > Losing on average 15/2 bytes to alignment, my kernel lose
> > # echo $((`cat System.map | grep '0 ' | wc -l`*15/2))
> > 149632
> > bytes only due to function alignment, not counting jump target
> > alighment.
> > 
> > Is there any way to prevent this?
> 
> Yes, there are ways of turning off a lot of this alignment padding and it
> makes a significant different in code size.  You need to dig around in the
> gcc documentation for the several -*align* options.
> 
> IIRC, not all of the padding could be turned off (the gcc options were not
> complete) but it's a couple of years since I investigated this.

Denis, there's a patch in -tiny to let you experiment with overriding
CFLAGS. See http://selenic.com/tiny-about/

You probably want something like:

-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1

-- 
Matt Mackall : http://www.selenic.com : Linux development and consulting

      reply	other threads:[~2004-02-27  1:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-26  6:44 [PATCH] __cacheline_aligned always in own section Rusty Russell
2004-02-26  6:53 ` viro
2004-02-26 22:09 ` Denis Vlasenko
2004-02-26 23:21   ` Andrew Morton
2004-02-27  1:01     ` Matt Mackall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040227010151.GI3883@waste.org \
    --to=mpm@selenic.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox