# How to disable hyperthreading in the kernel?

## few

Is it possible to tell the kernel to not use HT if it is enabled in the BIOS? Disabling in the BIOS is no option since I would have to do it on 64 systems.

Thanks for your help.

Edit: I forgot to mention, that disabling SMP is no option either, because there are two CPUs on each board.

----------

## massimo

Put noht in your boot loaders configuration file in the corresponding kernel line.

----------

## few

 *massimo wrote:*   

> Put noht in your boot loaders configuration file in the corresponding kernel line.

 

Did so, no change.

----------

## few

Thanks to Theimon on #gentoo who pointed me to [1], I have now a workaround.

cat /etc/init.d/disable_ht 

#!/sbin/runscript

depend() {

	before gmond

}

start() {

	ebegin "Disable CPU 1 und 3: "

	echo 0 > /sys/devices/system/cpu/cpu1/online

	echo 0 > /sys/devices/system/cpu/cpu3/online

	eend $? "Failed to start disable_ht"

}

stop() {

	ebegin "Enabling CPU 1 und 3: "

	echo 1 > /sys/devices/system/cpu/cpu1/online

	echo 1 > /sys/devices/system/cpu/cpu3/online

	eend $? "Failed to stop disable_ht"

}

By forcing it to start before gmond, I make ganglia report only 2 CPUs.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=440321

----------

## frenkel

Thanks for the script. I also couldn't get the "noht" option to work. Weird why it is listed as a valid option :S

----------

