*BSD News Article 78389


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!cancer.vividnet.com!hunter.premier.net!news.mathworks.com!enews.sgi.com!super.zippo.com!zdc!szdc!szdc-e!news
From: John Dyson <dyson@freebsd.org>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: gcc optimizations for kernel
Date: Sat, 14 Sep 1996 11:03:21 -0500
Organization: John S. Dyson's home machine
Lines: 28
Message-ID: <323AD749.41C67EA6@freebsd.org>
References: <51d0eg$9uf@usenet4.interramp.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0Gold (X11; U; FreeBSD 2.2-CURRENT i386)

dcmyers@access.digex.net wrote:
> 
> Following up on a comment made in the "Benchmarking different UNIX systems"
> thread, I'd like to know what the best gcc optimizations are for a FreeBSD
> kernel running on a Pentium.  For example, I noticed that the default
> Makefile uses plain ol' -O, as opposed to -O2 or -O3.  Is it safe to
> turn on the higher optimization levels?  And what sort of performance
> increase has been measured?  I'd happily trade a few tens of kilobytes
> of kernel size for better performance...
> 
Specifically, even though we (the FreeBSD team) do not currently support
it (and perhaps never will), you can (usually) compile and run your
kernel at -O2 -fomit-frame-pointer and get away with it.  On the older,
released code you might have to tack on a -fno-strength-reduce because
of a gcc bug.

On the plus side, you will find measurable kernel performance
improvement,
but the kernel will be bigger, and there will be more cache-misses. 
Also,
you will not be able to use kernel stack tracebacks.

I also once-in-a-while test the kernel with the pgcc.  Sometimes it
works, and sometimes it doesn't :-).  When I get some time, I'll start
giving the pgcc guys some feedback.

John