C problem...se megethos domhs

Aggelos Economopoulos aoiko at cc.ece.ntua.gr
Sun Jan 25 15:54:28 EET 2004


On Sun, 25 Jan 2004 15:12:54 +0200
V13 <v13 at priest.com> wrote:
[snip]
> > [1] Alla exe ypopsin sou oti to standard tis C den perigrafei to pos
> > kaleite i synartisi, px se merikes arxitektonikes oi parametroi den
> > pernane sto stack alla se registers, i den apeteite kan i yparksi
> > stack (an mporei to implementation na kanei oti prepei na kanei kai
> > xoris stack). Genikos i C kathorizei symperifora, oxi
> > implementation.
> 
> Sto C calling convention oles oi parametroi pernane stin stiba ektos
> kai an milame gia inline functions h tipota trela optimizations. AFAIK
> ayto poy perigrafeis einai extension orismenon compilers (p.x. borland
> opoy epitygxanetai me to __fastcall) to opoio pernaei tis protes 1-2
> parametroys se kataxorites.
> 
> To na pernas parametroys se kataxorites einai genika kakh idea, ektos
> kai an eisai sigoyros oti se mia sygkekrimeni periptosi kati tetoio
> tha boithisei... Ayto isxyei gia poly mikres functions oi opoies einai
> protimotero na ginontai inline (kai fysika den milame gia synartiseis
> poy anikoyn se bibliothikes mias kai to perasma parametron se
> kataxorites apokliei kati tetoio)

Den nomizw oti einai genika kakh idea. Blepe to mail tou Andi Kleen
sthn l-k (appended) kai to thread pou akolou8hse - ta kerdh orismenes
fores einai e3wpragmatika. E3allou, sunh8izw na to xrhsimopoiw (to
regparm __attribute__ tou gcc) otan 8elw na grapsw mia asm function :)

Aggelos

Date: Wed, 14 Jan 2004 10:06:03 +0100
From: Andi Kleen <ak at muc.de>
To: akpm at osdl.org
Cc: linux-kernel at vger.kernel.org, jh at suse.cz
Subject: [PATCH] Add CONFIG for -mregparm=3
Message-ID: <20040114090603.GA1935 at averell>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4i
Sender: linux-kernel-owner at vger.kernel.org
Precedence: bulk
X-Mailing-List: linux-kernel at vger.kernel.org


Using -mregparm=3 shrinks the kernel further:

(compiled with gcc 3.4, without -funit-at-a-time, using the later
and together with -Os shrinks .text even more, making over 700KB
difference) 

4129346  708629  207240 5045215  4cfbdf vmlinux
3892905  708629  207240 4808774  496046 vmlinux-regparm

This one helps even more, >236KB .text difference. Clearly worth
the effort.

This patch adds an option to use -mregparm=3 while compiling the kernel.
I did an LTP run and it showed no additional failures over an non 
regparm kernel.

According to some gcc developers it should be safe to use in all
gccs that are still supports (2.95 and up) 

I didn't make it the default because it will break all binary only
modules (although they can be fixed by adding a wrapper that 
calls them with "asmlinkage"). Actually it may be a good idea to 
make this default with 2.7.1 or somesuch.




More information about the Linux-greek-users mailing list