linux-kernelkvmhyperthreading

Hyper Threading: nosmt in grub configuration


Currently, I have running Debian 12 instance on dedicate CPU cloud environment. It has 2 cores, 4 threads. It is not impossible to turn off hyper threading via BIOS settings.

I found possibility to disable hyper threading via system setting in grub in /etc/default/grub adding 'nosmt':

GRUB_CMDLINE_LINUX="quiet nosmt"

I'm wondering is this something like good in terms of performance without hyper threading? I mean, will disabling it via system settings give the same effectiveness as disabling it via BIOS?

Or it bad idea to make it in that way and it is better to keep hyper threading off in this case (virtual dedicated CPU)?


Solution

  • Disabling SMT through the BIOS will give better performance.

    If you go through the BIOS, all resources will be made available to the single thread running on top of the core and if you go through the kernel some resources will not be available.

    Two examples:

    Both buffers are partitioned between the hypersiblings. So if the ROB has 256 entries, each hypersibling has 128 slots.

    If you disable it through the bios, the single thread will get 256 entries.

    If you disable it through the kernel, the single thread will get just 128 entries (because the CPU is already configured to use HT even though the OS won't use it).

    Not all resources suffer from this problem, e.g. execution units, physical registers, LFB's etc. So for these resources, disabling HT will provide more resources for the thread running on the core.