If you do a google search for disabling hyperthreading under CentOS/RHEL, you’ll find suggestions to disable each CPU instance that is a result of hyperthreading, because the “noht” command line parameter no longer works to disable hyperthreading. There is an easier way.
Disabling hyperthreading method 1: CPU hotplug
You can use the following method to disable a single CPU instance. However, the same architectures that enable hotplugging of CPUs using this method to disable an instance also support the “maxcpus” command line switch.
#echo 0 > /sys/devices/system/cpu/cpuX/online
Disabling hyperthreading method 2: maxcpus
Add this command line switch to your kernel’s boot parameters in /boot/grub/grub.conf, and then reboot. One can specify the number of CPUs that one wants the machine to use. I have a dual quad-core machine, so I want 8 logical processors, one for each physical core. My grub.conf contains the following line:
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
I changed it to the following, and then rebooted:
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet maxcpus=8
The machine will then boot with 8 logical processors instead of the 16 that I would normally get with hyperthreading enabled in the BIOS.
This appears to be better than disabling each processor using the online hotplug file, because the kernel won’t reserve resources for the extra processors, but if one can disable hyperthreading in the BIOS, one should try that first.
You can use the lstopo command available in the hwloc package to verify the processor topology.
I highly recommend disabling hyperthreading if one wants work to be done in the order it’s queued with minimal overhead.