core2 duo cpu optimizations in fedora kernels?

Dave Jones davej at redhat.com
Thu Oct 19 03:28:25 UTC 2006


On Wed, Oct 18, 2006 at 11:58:08AM +0200, Gianluca Cecchi wrote:
 > hello,
 > I would like to post a generic question and a specific one.
 > 
 > 1) I noticed that in EL kernels and also in fedora ones, the cpu
 > optimization selection in .config is generic CONFIG_M686 (that should
 > be PPro if I'm not wrong). Instead, in huge kernels there is
 > CONFIG_MPENTIUMIII set, I think because it was the first with PAE
 > capability perhaps?
 > Would one benefit getting the kernel.src.rpm package and compiling
 > with set up based on his own traget processor? For example
 > CONFIG_MPENTIUM4?
 > I think after PPro many microarchitecture changes has come...
 > Any drawbacks or possible incompatibility with the rest of the system?

You've missed the following patch that gets applied to the Fedora kernel.

--- linux-2.6.15/arch/i386/Makefile.cpu~        2006-01-09 11:39:04.000000000 -0500
+++ linux-2.6.15/arch/i386/Makefile.cpu 2006-01-09 11:39:36.000000000 -0500
@@ -15,7 +15,7 @@ cflags-$(CONFIG_M486)         += -march=i486
 cflags-$(CONFIG_M586)          += -march=i586
 cflags-$(CONFIG_M586TSC)       += -march=i586
 cflags-$(CONFIG_M586MMX)       += -march=pentium-mmx
-cflags-$(CONFIG_M686)          += -march=i686
+cflags-$(CONFIG_M686)          += -march=i686 $(call tune,generic)
 cflags-$(CONFIG_MPENTIUMII)    += -march=i686 $(call tune,pentium2)
 cflags-$(CONFIG_MPENTIUMIII)   += -march=i686 $(call tune,pentium3)
 cflags-$(CONFIG_MPENTIUMM)     += -march=i686 $(call tune,pentium3)

This means that gcc will always optimise for the CPUs of the day,
but at the same time, not use instructions which would prevent booting
on older CPUs.
 
 > Does the gcc version provided with fedora support optimizations for
 > these new processors?

yes

 >  And in case are these mapped in kernel capabilities then?

Where it really matters, the kernel will be using hand-written
assembly anyway (for eg, memcpy) so recompiling with different
switches will make no difference.  For other parts of the kernel
like RAID checksumming, the kernel will switch at runtime to
the fastest routines for the CPU it's being run on.

 > Does it make sense to consider intel compiler to compile kernel, as
 > for example it supports on Linux the switches -xT or –axT for
 > Merom/Conroe/Woodcrest processors?

Some people will claim so, but for 99% of users, you'll not notice
a single difference.  For most workloads the kernel isn't the bottleneck,
and for workloads where it *is* the bottleneck it usually needs something
more than just recompiling with different options to improve things.

	Dave

-- 
http://www.codemonkey.org.uk




More information about the test mailing list