linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, jh@suse.cz
Subject: [PATCH] Add CONFIG for -mregparm=3
Date: Wed, 14 Jan 2004 10:06:03 +0100	[thread overview]
Message-ID: <20040114090603.GA1935@averell> (raw)


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.

diff -u linux-34/arch/i386/Kconfig-o linux-34/arch/i386/Kconfig
--- linux-34/arch/i386/Kconfig-o	2004-01-09 09:27:09.000000000 +0100
+++ linux-34/arch/i386/Kconfig	2004-01-14 08:43:29.815530072 +0100
@@ -820,6 +820,14 @@
 	depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI))
 	default y
 
+config REGPARM
+	bool "Use register arguments (EXPERIMENTAL)"
+	default n
+	help
+	Compile the kernel with -mregparm=3. This uses an different ABI
+	and passes the first three arguments of a function call in registers.
+	This will probably break binary only modules.	
+	
 endmenu
 
 
diff -u linux-34/arch/i386/Makefile-o linux-34/arch/i386/Makefile
--- linux-34/arch/i386/Makefile-o	2003-09-28 10:53:14.000000000 +0200
+++ linux-34/arch/i386/Makefile	2004-01-13 20:16:32.000000000 +0100
@@ -47,6 +47,8 @@
 cflags-$(CONFIG_MCYRIXIII)	+= $(call check_gcc,-march=c3,-march=i486) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
 cflags-$(CONFIG_MVIAC3_2)	+= $(call check_gcc,-march=c3-2,-march=i686)
 
+cflags-$(CONFIG_REGPARM) 	+= -mregparm=3
+
 CFLAGS += $(cflags-y)
 
 # Default subarch .c files




             reply	other threads:[~2004-01-14  9:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-14  9:06 Andi Kleen [this message]
2004-01-14  9:16 ` [PATCH] Add CONFIG for -mregparm=3 Russell King
2004-01-14  9:30   ` Andi Kleen
2004-01-14  9:29 ` Andrew Morton
2004-01-14  9:35   ` Andi Kleen
2004-01-14 19:25     ` Adrian Bunk
2004-01-15 15:02       ` Andrea Arcangeli
2004-01-14  9:54   ` Arjan van de Ven
2004-01-14  9:34 ` Arjan van de Ven
2004-01-14  9:39   ` Andi Kleen
2004-01-14  9:44     ` Arjan van de Ven
2004-01-14  9:47   ` Andrew Morton
2004-01-15  0:40 ` Rusty Russell
2004-01-15  9:22   ` Andi Kleen
2004-01-17 20:16 ` several oopses during boot (was: Re: [PATCH] Add CONFIG for -mregparm=3) Sander
2004-01-17 20:53   ` Andi Kleen
2004-01-17 21:07     ` Sander
2004-01-17 21:28       ` Andi Kleen
2004-01-17 22:01         ` Mike Fedyk
2004-01-18  5:44         ` Sander
2004-01-18 20:34           ` Sander
2004-01-18 21:00             ` Andi Kleen
2004-01-19  6:47               ` Sander

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=20040114090603.GA1935@averell \
    --to=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=jh@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).