14

I have the feeling that hyperthreading is not activated on my pc. I took a look into /proc/cpuinfo and there is described that siblings has the same number than cpu cores. This means that hyperthreading is not activated. How can i activate it?

Part entries of /proc/cpuinfo:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 23
model name  : Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
stepping    : 6
cpu MHz     : 2997.000
cache size  : 6144 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 10
wp      : yes
15

/sys/bus/cpu/devices/cpu*/topology/thread_siblings_list shows the layout of cores and hyperthreads. To make it easier to visualise, I recommend using the lstopo command, install with:

sudo apt-get install hwloc

and run with:

lstopo

My ivybridge desktop has 4 CPUs; each has a hyperthread, so we get a diagram with Cores P#0..3 and each has two PU's (one of these being the hyperthread):

enter image description here

If you want just a text version of this output, use:

lstopo -
2
  • Not sure why no one has upvoted this yet... This is a really nice utility. Nov 5 '12 at 1:22
  • this is super cool. you see the total cache, cores, hyperthreads all in 1 image Jul 3 '14 at 4:38
9

Run top in a terminal, press number 1 in your keyboard to show load per cpu in the header, how many cpus are described there?

If they are the double of actual cores in your CPU hyperthreading is working as it should.

7

To detect if you are using hyperthreading (aka Intel Hyperthreading Technology) you can use dmidecode.

In a terminal:

sudo dmidecode > /tmp/dmidecode.txt
gksudo gedit /tmp/dmidecode.txt

Look for a Status value of Populated, Enabled (shown below between * ... *) i.e. "Enabled" means that hyperthreading is active

Physical CPU
Handle 0x000C, DMI type 4, 32 bytes
Processor Information
Socket Designation: Socket 1 CPU 1
Type: Central Processor
Family: Xeon
Manufacturer: GenuineIntel
ID: 43 0F 00 00 01 03 00 00
Signature: Type 0, Family 15, Model 4, Stepping 3
Flags:
FPU (Floating-point unit on-chip)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
Version: Intel Xeon
Voltage: 1.5 V
External Clock: 200 MHz
Max Speed: 4000 MHz
Current Speed: 3800 MHz
Status: *Populated, Enabled*
Upgrade: ZIF Socket
L1 Cache Handle: 0x0004
L2 Cache Handle: 0x0005
L3 Cache Handle: Not Provided

In a Hyperthreaded logical CPU you will see a Status value of unpopulated (shown below between * ... *):

Handle 0x000D, DMI type 4, 32 bytes
Processor Information
Socket Designation: Socket 2 CPU 2
Type: Unknown
Family: Unknown
Manufacturer: Not Specified
ID: 00 00 00 00 00 00 00 00
Version: Not Specified
Voltage: 1.5 V
External Clock: 200 MHz
Max Speed: 4000 MHz
Current Speed: 3800 MHz
Status: *Unpopulated*
Upgrade: ZIF Socket
L1 Cache Handle: 0x0006
L2 Cache Handle: 0x0007
L3 Cache Handle: Not Provided

source

2
  • The Linux kernel determines the number of CPUs and siblings from the CPU (using CPUID topology enumeration) rather than using the BIOS configured DMI data. I suspect that the DMI data is configured at boot time from the same CPUID data that the kernel uses, however, it is probably best to trust what the Linux kernel has determined rather than from DMI data. As it happens, in the majority of cases the BIOS probably gets it right. Oct 17 '12 at 21:23
  • The dmicode output doesn't change if hyperthreading is disabled - it just indicates whether the CPU supports hyperthreading. For example, on a i7-6600U CPU system with disabled hyperthreading dmidecode | grep -i popula also prints Status: Populated, Enabled. See also my answer. Aug 24 '19 at 17:37
2

in the result of dmidecode, you can get something like

    Core Count: 6
    Core Enabled: 6
    Thread Count: 12

on servers with hyper thread set to ON

or

    Core Count: 6
    Core Enabled: 6
    Thread Count: 6

on those set to OFF

1
  • This doesn't work. The Thread Count doesn't change if hyperthreading is disabled, e.g. on a i7-6600U system with hyperthreading disabled dmidecode | grep '\(Core\|Thread\).*:' prints Core Count: 2 Core Enabled: 2 Thread Count: 4. Aug 24 '19 at 17:41
1

Spoiler: your CPU doesn't support hyperthreading.

An alternative to consulting the CPU vendor's database is to check /proc/cpuinfo for the ht flag:

$ grep -o '\<ht\>' /proc/cpuinfo

Even if hyperthreading is disabled in the BIOS, the flag should be included in that output.

To check if hyperthreading is actually enabled you can consult another pseudo file:

$ cat /sys/devices/system/cpu/smt/control

Possible values are: on|off|forceoff|notsupported|notimplemented

You can enable/disable hyperthreading by writing on/off to that pseudo file, e.g.:

# echo off > /sys/devices/system/cpu/smt/control

Of course, this doesn't work if the cat previously printed one of forceoff|notsupported|notimplemented.

Usually, hyperthreading is enabled, by default. And if it's disabled it's commonly done so in the BIOS. If it's disabled in the BIOS that pseudo file likely contains forceoff and you have to change the setting in the BIOS.

1
  • Thanks for the link to Intel. It turns out my CPU does not support hyperthreading.
    – thomasa88
    Oct 3 '20 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.