Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Make gcc -align options .config-settable
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Denis Vlasenko  
View profile  
 More options Oct 1 2004, 3:35 pm
Newsgroups: fa.linux.kernel
From: Denis Vlasenko <v...@port.imtp.ilyichevsk.odessa.ua>
Date: Fri, 1 Oct 2004 19:35:14 GMT
Local: Fri, Oct 1 2004 3:35 pm
Subject: [PATCH] Make gcc -align options .config-settable

Resend.

With all alignment options set to 1 (minimum alignment),
I've got 5% smaller vmlinux compared to one built with
default code alignment.

Rediffed against 2.6.9-rc3.
Please apply.
--
vda

  align269r3.patch
2K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Morton  
View profile  
 More options Oct 1 2004, 6:23 pm
Newsgroups: fa.linux.kernel
From: Andrew Morton <a...@osdl.org>
Date: Fri, 1 Oct 2004 22:23:54 GMT
Local: Fri, Oct 1 2004 6:23 pm
Subject: Re: [PATCH] Make gcc -align options .config-settable

Denis Vlasenko <v...@port.imtp.ilyichevsk.odessa.ua> wrote:

> With all alignment options set to 1 (minimum alignment),
> I've got 5% smaller vmlinux compared to one built with
> default code alignment.

Sam, can you process this one?

> +GCC_VERSION       = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))

It bugs me that we're evaluating the same thing down in arch/i386/Makefile.
 Perhaps we should evaluate GCC_VERSION once only, as some top-level kbuild
thing.  So everyone can assume that it's present and correct?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bill Davidsen  
View profile  
 More options Oct 4 2004, 2:38 pm
Newsgroups: fa.linux.kernel
From: Bill Davidsen <david...@tmr.com>
Date: Mon, 4 Oct 2004 18:38:14 GMT
Local: Mon, Oct 4 2004 2:38 pm
Subject: Re: [PATCH] Make gcc -align options .config-settable

Denis Vlasenko wrote:
> Resend.

> With all alignment options set to 1 (minimum alignment),
> I've got 5% smaller vmlinux compared to one built with
> default code alignment.

It would be interesting to know if this is better WRT cache usage than
alignment which ensures that loops fit within the minimum number of
cache lines. That's not quite the same thing as starting on a cache line
in all cases.

This may be of interest to embedded builds.

--
    -bill davidsen (david...@tmr.com)
"The secret to procrastination is to put things off until the
  last possible moment - but no longer"  -me
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Ravnborg  
View profile  
 More options Oct 4 2004, 4:05 pm
Newsgroups: fa.linux.kernel
From: Sam Ravnborg <s...@ravnborg.org>
Date: Mon, 4 Oct 2004 20:05:26 GMT
Local: Mon, Oct 4 2004 4:05 pm
Subject: Re: [PATCH] Make gcc -align options .config-settable

On Fri, Oct 01, 2004 at 03:17:51PM -0700, Andrew Morton wrote:
> Denis Vlasenko <v...@port.imtp.ilyichevsk.odessa.ua> wrote:

> > With all alignment options set to 1 (minimum alignment),
> > I've got 5% smaller vmlinux compared to one built with
> > default code alignment.

> Sam, can you process this one?

I will do so in a week or so.
Travelling (and busy) these days.

        Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Keith Owens  
View profile  
 More options Oct 8 2004, 1:05 am
Newsgroups: fa.linux.kernel
From: Keith Owens <k...@ocs.com.au>
Date: Fri, 8 Oct 2004 05:05:15 GMT
Local: Fri, Oct 8 2004 1:05 am
Subject: Re: [PATCH] Make gcc -align options .config-settable
On Fri, 1 Oct 2004 15:17:51 -0700,

Using '=' is wrong here, it will evaluate the complete expression every
time GCC_VERSION is tested.  It should be ':='.  The only time '='
should be used in a Makefile is when delayed evaluation is really
required, e.g. for strings that are the target of $(call).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andi Kleen  
View profile  
 More options Oct 8 2004, 8:25 am
Newsgroups: fa.linux.kernel
From: Andi Kleen <a...@muc.de>
Date: Fri, 8 Oct 2004 12:25:28 GMT
Local: Fri, Oct 8 2004 8:25 am
Subject: Re: [PATCH] Make gcc -align options .config-settable

Denis Vlasenko <v...@port.imtp.ilyichevsk.odessa.ua> writes:
> Resend.

> With all alignment options set to 1 (minimum alignment),
> I've got 5% smaller vmlinux compared to one built with
> default code alignment.

> Rediffed against 2.6.9-rc3.
> Please apply.

I agree with the basic idea (the big alignments also always annoy
me when I look at disassembly), but I think your CONFIG options
are far too complicated. I don't think anybody will go as far as
to tune loops vs function calls.

I would just do a single CONFIG_NO_ALIGNMENTS that sets everything to
1, that should be enough.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Denis Vlasenko  
View profile  
 More options Oct 8 2004, 10:12 am
Newsgroups: fa.linux.kernel
From: Denis Vlasenko <v...@port.imtp.ilyichevsk.odessa.ua>
Date: Fri, 8 Oct 2004 14:12:53 GMT
Local: Fri, Oct 8 2004 10:12 am
Subject: Re: [PATCH] Make gcc -align options .config-settable
On Friday 08 October 2004 12:20, Andi Kleen wrote:

For me, yes, but there are people which are slightly less obsessed
with code size than me.

They might want to say "try to align to 16 bytes if
it costs less than 5 bytes" etc.

Also bencmarking people may do little research on real usefulness of
various kinds of alignment.
--
vda
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Grzegorz Kulewski  
View profile  
 More options Oct 8 2004, 10:33 am
Newsgroups: fa.linux.kernel
From: Grzegorz Kulewski <kan...@polcom.net>
Date: Fri, 8 Oct 2004 14:33:23 GMT
Local: Fri, Oct 8 2004 10:33 am
Subject: Re: [PATCH] Make gcc -align options .config-settable

I think that removing aligns completly will be very bad. I am Gentoo user
and I set my user space CFLAGS for all system to -falign-loops
-fno-align-<everything else>. I did not tested it in depth, but my simple
tests show that unaligning loops is a very bad idea. Unaligning functions
is safer since small and fast functions should be always inlined.

Thanks,

Grzegorz Kulewski

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andi Kleen  
View profile  
 More options Oct 8 2004, 11:51 am
Newsgroups: fa.linux.kernel
From: Andi Kleen <a...@muc.de>
Date: Fri, 8 Oct 2004 15:51:33 GMT
Local: Fri, Oct 8 2004 11:51 am
Subject: Re: [PATCH] Make gcc -align options .config-settable

If they want to go down to that low level they can as well edit
the Makefiles. But we already have far too many configs and
adding new ones for obscure compiler options is not a good idea.

Also we don't normally add stuff "just in case", but only when
people actually use it.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Denis Vlasenko  
View profile  
 More options Oct 8 2004, 4:44 pm
Newsgroups: fa.linux.kernel
From: Denis Vlasenko <v...@port.imtp.ilyichevsk.odessa.ua>
Date: Fri, 8 Oct 2004 20:44:01 GMT
Local: Fri, Oct 8 2004 4:44 pm
Subject: Re: [PATCH] Make gcc -align options .config-settable
On Friday 08 October 2004 17:30, Grzegorz Kulewski wrote:

> > Also bencmarking people may do little research on real usefulness of
> > various kinds of alignment.

> I think that removing aligns completly will be very bad. I am Gentoo user
> and I set my user space CFLAGS for all system to -falign-loops
> -fno-align-<everything else>. I did not tested it in depth, but my simple
> tests show that unaligning loops is a very bad idea. Unaligning functions

That depends on how often that loop runs. 90% of code runs only
10% of time. I think ultimately we want to mark other 10% of code with:

int __hotpath often_called_func()
{
...

}

Rest of code is to be optimized for size.

> is safer since small and fast functions should be always inlined.

Concept of alignment does not apply to inlined functions at all.
--
vda

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Denis Vlasenko  
View profile  
 More options Oct 8 2004, 4:53 pm
Newsgroups: fa.linux.kernel
From: Denis Vlasenko <v...@port.imtp.ilyichevsk.odessa.ua>
Date: Fri, 8 Oct 2004 20:53:21 GMT
Local: Fri, Oct 8 2004 4:53 pm
Subject: Re: [PATCH] Make gcc -align options .config-settable

> > > I would just do a single CONFIG_NO_ALIGNMENTS that sets everything to
> > > 1, that should be enough.

> > For me, yes, but there are people which are slightly less obsessed
> > with code size than me.

> > They might want to say "try to align to 16 bytes if
> > it costs less than 5 bytes" etc.

> If they want to go down to that low level they can as well edit
> the Makefiles. But we already have far too many configs and
> adding new ones for obscure compiler options is not a good idea.

> Also we don't normally add stuff "just in case", but only when
> people actually use it.

I have a suspicion that if I had submitted CONFIG_NO_ALIGNMENTS
patch instead, there would be comments from another crowd,
about it being too coarse.

Look at the post of Grzegorz Kulewski.

Anyway, I don't have strong preference. I just want to be at least
able to disable code alignment completely.
--
vda

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Grzegorz Kulewski  
View profile  
 More options Oct 8 2004, 5:31 pm
Newsgroups: fa.linux.kernel
From: Grzegorz Kulewski <kan...@polcom.net>
Date: Fri, 8 Oct 2004 21:31:51 GMT
Local: Fri, Oct 8 2004 5:31 pm
Subject: Re: [PATCH] Make gcc -align options .config-settable

On Fri, 8 Oct 2004, Denis Vlasenko wrote:
> On Friday 08 October 2004 17:30, Grzegorz Kulewski wrote:
>>> Also bencmarking people may do little research on real usefulness of
>>> various kinds of alignment.

>> I think that removing aligns completly will be very bad. I am Gentoo user
>> and I set my user space CFLAGS for all system to -falign-loops
>> -fno-align-<everything else>. I did not tested it in depth, but my simple
>> tests show that unaligning loops is a very bad idea. Unaligning functions

> That depends on how often that loop runs. 90% of code runs only
> 10% of time. I think ultimately we want to mark other 10% of code with:

Well, loops should probably always be aligned because aligning them will
not make the code significantly larger (I think, I did not mensure it),
but it will make the code significantly faster, and more friendly to
processor's cache.

>> is safer since small and fast functions should be always inlined.

> Concept of alignment does not apply to inlined functions at all.

That is my point. It is safe not to align functions because fast and often
called ones will be inlined and will not be slowed down by lack of
alignment.

Thanks,

Grzegorz Kulewski

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Ravnborg  
View profile  
 More options Oct 16 2004, 6:40 pm
Newsgroups: fa.linux.kernel
From: Sam Ravnborg <s...@ravnborg.org>
Date: Sat, 16 Oct 2004 22:40:51 GMT
Local: Sat, Oct 16 2004 6:40 pm
Subject: Re: [PATCH] Make gcc -align options .config-settable

Started looking into this.
gcc does not document what happens if -falign-functions=x is specified more than
once. It works but I have not checked the effect.
It will occur for some CPU's

        Sam

Current patch to top-level Makefile looks like this.

===== Makefile 1.542 vs edited =====
--- 1.542/Makefile      2004-10-17 02:00:48 +02:00
+++ edited/Makefile     2004-10-17 02:29:56 +02:00
@@ -295,6 +295,11 @@
 cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
                 > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)

+# cc-option-align
+# Prefix align with either -falign or -malign
+cc-option-align = $(subst -functions=0,,\
+       $(call cc-option,-falign-functions=0,-malign-functions=0))
+
 # cc-version
 # Usage gcc-ver := $(call cc-version $(CC))
 cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
@@ -497,6 +502,13 @@
 else
 CFLAGS         += -O2
 endif
+
+#Add aling options in CONFIG_CC_ not equal to 0
+add-align = $(if $(filter-out 0,$($(1))),$(cc-option-align)$(2)=$($(1)))
+CFLAGS         += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-functions)
+CFLAGS         += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)
+CFLAGS         += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)
+CFLAGS         += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)

 ifdef CONFIG_FRAME_POINTER
 CFLAGS         += -fno-omit-frame-pointer
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »