by  Marirs

Is Hyper Threading enabled?

There are times when you need to know whether hyper-threading is enabled without the luxury to reboot the system to check the BIOS or You know for sure, that it is enabled in the BIOS, but you need to check at the node level.

You can simply look at the output of /proc/cpuinfo and compare the siblings with the cpu cores fields. Although /proc/cpuinfo shows you all the logical CPUs (processor field) in the system, the siblings field holds the number of logical CPUs for the physical CPU this entry belongs to (including both the cores and the hyper-threaded LCPUs).

If the number of cpu cores is the same as the number of siblings, hyper-threading is disabled.

Below are different examples of how to check if Hyper threading is enabled.

  • Using information from /proc/cpuinfo
    [[email protected]]$ egrep 'processor|siblings|cpu cores' /proc/cpuinfo | head -3
    processor : 0
    siblings : 4
    cpu cores : 2

    In the above example; the LCPU #0 (the first logical CPU in your system) is one of the 4 logical CPUs on the physical CPU that has 2 cores. So yes, hyper-threading is enabled.

    [[email protected]]$ cat /proc/cpuinfo | grep -i flags | head -1
    flags : fpu vme ht de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse 
    sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc 
    aperfmperf pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes xsave avx f16c rdrand hypervisor 
    lahf_lm ida arat epb pln pts dtherm fsgsbase smep                       

    In the above, you can see the “ht” in the flags section. This also tells you that hyper-threading is enabled.

  • Using the lscpu command
    [[email protected]]$ lscpu | grep -i -E "^CPU\(s\):|core|socket"
    CPU(s): 24
    Thread(s) per core: 2
    Core(s) per socket: 6
    Socket(s): 2

    As you can see, number of threads per core is 2, so it’s HT enabled.

  • Another way to check us to install dmidecode (if it isnt already available).
    [[email protected]]$ /usr/sbin/dmidecode | grep -E "Socket Designation: Node |HTT"
    Socket Designation: Node 1 Socket 1
    HTT (Multi-threading)
    Socket Designation: Node 1 Socket 2
    HTT (Multi-threading)

    In the above, It tells you that HT is enabled.

    [[email protected]]$ /usr/sbin/dmidecode | grep Count
    Core Count: 4
    Thread Count: 8

    Again, here it tells you the thread count of the cores.

If you know any other ways to check for hyper-threading at node level, send me note, and I'll be happy to add it in here.