Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 115781

Summary: Hyper Threading slowdown
Product: Gentoo Linux Reporter: Alex Efros <powerman-asdf>
Component: [OLD] Core systemAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Severity: major    
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Package list:
Runtime testing required: ---

Description Alex Efros 2005-12-16 08:14:46 UTC
Executing simple CPU test on Intel(R) Pentium(R) 4 CPU 3.00GHz (with Hyper 
Threading enabled) show about 3 times slowdown when 2 processes use CPU 
simultaneously. This slowdown exists in:
- sys-kernel/hardened-sources-2.6.14-r1
- sys-kernel/gentoo-sources-2.6.14-r4
- sys-kernel/vanilla-sources-
but there no such slowdown in kernel supplied with Fedora Core 2 "Linux version 
2.6.14-051115a (somebody@somewhere) (gcc version 3.3.5 (Debian 1:3.3.5-13)) #1 
SMP Tue Nov 15 13:06:41 CET 2005" (probably this kernel isn't really from 
Fedora, maybe it was compiled by my ISP for my dedicated server, don't sure).

My CPU test is simple. Here results from Fedora:

# time perl -e '$pid=fork if @ARGV; print "$$ started\n"; $i++ for 1..100000000; 
print "$$ finished\n"; print("waiting for $pid\n"), wait() if $pid'
1001 started
1001 finished

real    0m11.118s
user    0m11.117s
sys     0m0.000s

# time perl -e '$pid=fork if @ARGV; print "$$ started\n"; $i++ for 1..100000000; 
print "$$ finished\n"; print("waiting for $pid\n"), wait() if $pid' 1
1003 started
1002 started
1003 finished
1002 finished
waiting for 1003

real    0m23.818s          ### ATTENTION HERE !!!
user    0m47.627s
sys     0m0.000s

and here results from Gentoo (with any *-sources listed above):

# time perl -e '$pid=fork if @ARGV; print "$$ started\n"; $i++ for 1..100000000; 
print "$$ finished\n"; print("waiting for $pid\n"), wait() if $pid'
4493 started
4493 finished

real    0m12.490s
user    0m12.485s
sys     0m0.004s

# time perl -e '$pid=fork if @ARGV; print "$$ started\n"; $i++ for 1..100000000; 
print "$$ finished\n"; print("waiting for $pid\n"), wait() if $pid' 1
4495 started
4494 started
4494 finished
waiting for 4495
4495 finished

real    1m7.266s          ### ATTENTION HERE !!!
user    2m14.432s
sys     0m0.000s

All these kernels was compiled with exactly same .config (which I take from 
Fedora's /proc/config.gz). All these kernels show nearly same information in /
proc/cpuinfo, dmesg and lsmod.

Probably some patch (from Fedora?) should be added to gentoo-sources & hardened-
sources to fix this issue...
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-12-16 08:16:55 UTC
*gentoo-sources-2.6.14-r5 (15 Dec 2005)

  15 Dec 2005; Daniel Drake <>
  Update to Linux Really fix the hyperthreading slowdown. Fix NUMA
  boot problem.

Reopen it if still does not work when with latest gentoo-sources.
Comment 2 Alex Efros 2005-12-16 08:52:08 UTC
No, it doesn't work with sys-kernel/gentoo-sources-2.6.14-r5. :-(

Don't sure is it important, but I use sys-devel/gcc-3.4.4-r1 (HARDENED) for 
compiling kernel. And, just for the case, here is my `emerge info`:

Portage (hardened/x86/2.6, gcc-3.4.4, glibc-2.3.5-r2, 2.6.14-
gentoo-r5 i686)
System uname: 2.6.14-gentoo-r5 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.4.3-r4, 1.5.20
virtual/os-headers:  2.6.11-r2
CFLAGS="-O2 -march=pentium4 -pipe"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/
config /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -pipe"
FEATURES="autoconfig buildpkg ccache distlocks sandbox sfperms strict userpriv 
GENTOO_MIRRORS=" ftp://pandemonium."
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage-java-experimental /usr/
USE="acpi aim apache2 berkdb bzip2 crypt curl dlloader expat gd gdbm gif 
hardened icq idn imagemagick imap irc jabber java javascript jpeg junit 
lm_sensors mailbox mbox mmx msn mysql ncurses nls nptl nptlonly pam pcre perl 
pic png pwdb python readline rss slang sse sse2 ssl sysfs tcpd tiff truetype 
udev userlocales x86 xinetd xml2 yahoo zlib userland_GNU kernel_linux 
Comment 3 Daniel Drake (RETIRED) gentoo-dev 2005-12-23 15:41:45 UTC
Please test vanilla-sources-2.6.15_rc6 with this additional patch applied:;a=commitdiff_plain;h=1e483969930a82e16767884449f3a121a817ef00;hp=4c0335526c95d90a1d958e0059f40a5745fc7c5d
Comment 4 Alex Efros 2005-12-24 05:21:34 UTC
(In reply to comment #3)
> Please test vanilla-sources-2.6.15_rc6 with this additional patch applied:

Bad idea. :-(
With this patch kernel don't boot. This is dedicated server on good enough hosting which provide 'serial console' and 'rescue network boot'. I've checked serial console, but there was no output from booting kernel, so it's probably hang before serial console driver was loaded. Then I've used 'rescue network boot' mode to login to my server and change grub.conf to load another kernel - same vanilla-sources-2.6.15_rc6, but without that patch. It's boot ok, but "hyper threading slowdown" bug still exists in this version.

I notice some part of this patch in '#ifdef CONFIG_HOTPLUG_CPU', so I've enabled in my kernel CONFIG_HOTPLUG_CPU and tried again to boot kernel with this patch - without success - it hangs again.
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2005-12-24 06:31:48 UTC
Have you tried 2.6.15-rc6 without the patch?
Comment 6 Daniel Drake (RETIRED) gentoo-dev 2005-12-24 08:13:56 UTC
Also, maybe you could try 2.6.14-r5 with CONFIG_HOTPLUG_CPU enabled and see if that helps.
Comment 7 Alex Efros 2005-12-24 08:57:25 UTC
Yeah, I have tried 2.6.15-rc6 without the patch (see comment #4).

I've just tried 2.6.14-r5 with CONFIG_HOTPLUG_CPU enabled. This don't fix the bug.
Comment 8 Tim Yamin (RETIRED) gentoo-dev 2006-01-03 15:08:53 UTC
Looks like an upstream bug - if you still get this with 2.6.15 vanilla please post to the LKML and reference this bug.

Comment 9 Alex Efros 2006-01-04 10:37:21 UTC
2.6.15 vanilla hangs if CONFIG_HOTPLUG_CPU enabled. If CONFIG_HOTPLUG_CPU disabled - it boot ok, but 'hyper threading slowdown' issue still exists. :-(
Enabling/disabling CONFIG_SCHED_SMT has no effect.