Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel Compile Tweaks For Speed Freaks
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
proxy
Apprentice
Apprentice


Joined: 20 Apr 2002
Posts: 260
Location: Chantilly, VA

PostPosted: Fri Jun 06, 2003 7:54 pm    Post subject: Kernel Compile Tweaks For Speed Freaks Reply with quote

so, i've been toying around with the 2.5.x sources every now and then and noticed that they started using better march options if you got gcc-3.0+.

so i thought, why wouldn't this work with the 2.4 series. The increase is probably negligable, but still, every little bit counts, and little tweaks like this are what gentoo is all about ;)

it's a easy no brainer change really..

edit:
Code:
/usr/src/linux/arch/i386/Makefile


and for penitum-4 change this line:

Code:

ifdef CONFIG_MPENTIUM4
CFLAGS += -march=i686
endif


to

Code:

ifdef CONFIG_MPENTIUM4
CFLAGS += -march=pentium4
endif


this applies to all other types of processors, just look for your "CONFIG_WHATEVER" section and set to your likeing.

i recommend this only if you have gcc-3.3 installed as 3.2 had sse issues and for a kernel, you want maximum stability. I've been running with it with those flags for a bit now and it seems perfectly stable :)
Back to top
View user's profile Send private message
discomfitor
l33t
l33t


Joined: 21 Feb 2003
Posts: 927
Location: None

PostPosted: Sat Jun 07, 2003 6:53 pm    Post subject: Reply with quote

Actually, I've tried doing this. Only I just inserted my current CFLAGS from make.conf
Code:
CFLAGS="-march=pentium4 -Os -fmerge-all-constants -finline-functions -mfpmath=sse -ffast-math -mpush-args -msse2 -msse -mmmx -pipe -fforce-addr -fomit-frame-pointer -falign-functions=32 -falign-jumps"

Been running this for almost a month without rebooting and been compiling and doing other cpu intensive activities for most of the time; no crashes. undefined
_________________
There is no substitute for experience.
Imperfection indicates a lack of effort.
Back to top
View user's profile Send private message
Ian
l33t
l33t


Joined: 28 Oct 2002
Posts: 834
Location: Somerville, MA

PostPosted: Sat Jun 07, 2003 9:18 pm    Post subject: Reply with quote

is there a bunch of CFLAGS that can be enabled for all processors to speed up the computer? i know i have a few for my CPU (apparently it's a t-bird, i thought it was a regular athlon), but no where near as many as Darckness does. i'm sure this has been answered, but i figure someone will ask in this thread sooner or later (looks like sooner :p).
Back to top
View user's profile Send private message
discomfitor
l33t
l33t


Joined: 21 Feb 2003
Posts: 927
Location: None

PostPosted: Sat Jun 07, 2003 11:42 pm    Post subject: Reply with quote

check the 'cflags central' thread; there's tons of athlon examples in there. you could probably use the same ones as I do (remove sse2 and pentium4) and add in your -march specs. give it a try, since the worst that happens is that you have to go back to your old kernel (which you'll keep in case something screws up) and remove some more agressive flags
_________________
There is no substitute for experience.
Imperfection indicates a lack of effort.
Back to top
View user's profile Send private message
proxy
Apprentice
Apprentice


Joined: 20 Apr 2002
Posts: 260
Location: Chantilly, VA

PostPosted: Tue Jun 10, 2003 9:04 pm    Post subject: Reply with quote

i would NOT advise changing things like the stack/loop/jumps alignment. Many parts of the kernel are designed to be very cache friendly, and by aligning to a different size you may actually make functions that used to fit entirely int he cache not anymore (this could devistate performance if it affects say..the VM sub-system) :P There are many reasons for the different flags they put in there, but asking it to make use of less aggressive architectural optimizations should be safe (I only tried because I saw them using it safetly in 2.5.x series actually).

Good luck though :P

proxy
Back to top
View user's profile Send private message
RobMcM
Apprentice
Apprentice


Joined: 11 Jul 2003
Posts: 170
Location: Leeds, UK

PostPosted: Fri Jul 11, 2003 7:14 pm    Post subject: Reply with quote

proxy wrote:
i would NOT advise changing things like the stack/loop/jumps alignment. Many parts of the kernel are designed to be very cache friendly, and by aligning to a different size you may actually make functions that used to fit entirely int he cache not anymore (this could devistate performance if it affects say..the VM sub-system) :P There are many reasons for the different flags they put in there, but asking it to make use of less aggressive architectural optimizations should be safe (I only tried because I saw them using it safetly in 2.5.x series actually).

Good luck though :P

proxy



Doesn't the kernel use its own CFLAGS (like glibc, mplayer and a few others)? When I compile mine, it only uses my -march setting and then optimisations seem vary between none and -O2
Back to top
View user's profile Send private message
RedBeard0531
Guru
Guru


Joined: 21 Sep 2002
Posts: 415
Location: maryland

PostPosted: Sat Jul 12, 2003 4:04 am    Post subject: Reply with quote

RobMcM wrote:

Doesn't the kernel use its own CFLAGS (like glibc, mplayer and a few others)? When I compile mine, it only uses my -march setting and then optimisations seem vary between none and -O2


glibc doesnt realy use its own, the ebuild merly strips agressive flags out. If you want to use them, comment out strip-flags in the ebuild. The reason kernels use there own is because the arent COMPILED with emerge, just unpacked, and patched. Make.conf seetings only aplly to things compiled by emerge
_________________
OH MY GOD! Kenny just killed Kenny!
That Basterd!
Back to top
View user's profile Send private message
blu3bird
Retired Dev
Retired Dev


Joined: 04 Oct 2003
Posts: 612
Location: Munich, Germany

PostPosted: Tue Jan 24, 2006 3:40 pm    Post subject: Reply with quote

To keep this up to date:

For kernel 2.6.15.1 and higher edit
Code:
/usr/src/linux/arch/i386/Makefile.cpu
Back to top
View user's profile Send private message
Soul_rebel
Tux's lil' helper
Tux's lil' helper


Joined: 12 Nov 2004
Posts: 88

PostPosted: Tue Jan 24, 2006 6:44 pm    Post subject: Reply with quote

the kernel makefile actually sets -march=whatever on its own.
_________________
LinuX @ the Speed of Thought
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum