can't disable hyperthreading on 7.1

Mikolaj Golub to.my.trociny at gmail.com
Mon Dec 29 18:10:01 UTC 2008


On Wed, 24 Dec 2008 15:36:10 +0200 Alexander Melnik wrote:

 AM> Hi

 AM> I have several computers with 2 xeon processors with hyperthreading under FreeBSD 7.1-RC2 and in any case can not turn off hyperthreading:

 AM> [old at vmat ~]$ cat /boot/loader.conf
 AM> machdep.hyperthreading_allowed="0"
 AM> machdep.hlt_logical_cpus="1"

 AM> [old at vmat ~]$ sysctl machdep.hyperthreading_allowed
 AM> machdep.hyperthreading_allowed: 0

 AM> [old at vmat ~]$ sysctl machdep.hlt_logical_cpus
 AM> machdep.hlt_logical_cpus: 1

 AM> [old at vmat ~]$ sysctl hw.ncpu
 AM> hw.ncpu: 4

 AM> If machdep.hyperthreading_allowed = "0", the hw.ncpu must be equal to 2?

 AM> [old at vmat ~]$ top -nd 1
 AM> last pid:   825;  load averages:  0.00,  0.00,  0.00  up 0+00:21:19    15:22:24
 AM> 17 processes:  1 running, 16 sleeping

 AM> Mem: 6228K Active, 6984K Inact, 20M Wired, 9520K Buf, 960M Free
 AM> Swap: 2048M Total, 2048M Free


 AM>   PID USERNAME  THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
 AM>   762 root        1   4    0  8428K  3936K sbwait 2   0:00  0.00% sshd
 AM>   767 old         1   8    0  4396K  2212K wait   2   0:00  0.00% bash
 AM>   765 old         1  44    0  8428K  3952K select 0   0:00  0.00% sshd
 AM>   571 root        1  44    0  3184K  1200K select 1   0:00  0.00% syslogd
 AM>   706 root        1  44    0  5876K  3196K select 0   0:00  0.00% sendmail
 AM>   716 root        1   8    0  3212K  1276K nanslp 2   0:00  0.00% cron
 AM>   759 root        1   5    0  3184K  1088K ttyin  2   0:00  0.00% getty
 AM>   758 root        1   5    0  3184K  1088K ttyin  3   0:00  0.00% getty
 AM>   760 root        1   5    0  3184K  1088K ttyin  0   0:00  0.00% getty
 AM>   700 root        1  44    0  5752K  3276K select 0   0:00  0.00% sshd
 AM>   710 smmsp       1  20    0  5876K  3200K pause  2   0:00  0.00% sendmail
 AM>   297 root        1  96    0  3128K  1208K select 0   0:00  0.00% dhclient
 AM>   737 root        1  96    0  3240K  1152K select 3   0:00  0.00% inetd
 AM>   163 root        1  20    0  1380K   804K pause  0   0:00  0.00% adjkerntz
 AM>   512 root        1  44    0  1888K   564K select 0   0:00  0.00% devd
 AM>   313 _dhcp       1  44    0  3128K  1320K select 0   0:00  0.00% dhclient
 AM>   825 old         1  44    0  3496K  1656K CPU0   0   0:00  0.00% top

 AM>         
 AM> If machdep.hlt_logical_cpus = "1" in the output top in any case should not be seen processors 2 and 3?

You can run

vmstat -i | grep cpu

to see how many CPUs are actually used.

I also observe on some hosts (6.3) with machdep.hlt_logical_cpus=1 that in C
column of top output there appear CPU numbers for CPUs that are actually
halted according to vmstat -i and I am curious too what this means.

-- 
Mikolaj Golub


More information about the freebsd-stable mailing list