Resposta anterior é muito interessante.
Depois de pesquisar no Google, encontrei alguns assuntos relacionados:
No último link, o script python não funciona quando o host possui muitos IDs físicos. Tentei modificá-lo com uma condição diferente no final:
Alterando:
if p > 0:
para
if p % 2 == 1:
Mas não funciona como esperado, com base na mensagem anterior. A propósito, você pode fazer algo mais abrangente do que:
grep . /sys/devices/system/cpu/cpu{,1}?/topology/thread_siblings | tr : \\\t | sed -r 's,^,\s\s\s\s,'
com:
for file in /sys/devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list; do echo -n "$file "; cat $file; done |sort -k2 -n
[...]
O que é interessante em um host de muitos núcleos com o hyperthreading é a distribuição de núcleos lógicos no hardware.
Por exemplo, em um dos meus computadores (48 núcleos lógicos, 2 processadores físicos, 24 (12 * 2) 'núcleos reais' (também 24 núcleos virtuais)):
for file in /sys/devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list; do echo -n "$file "; cat $file; done |sort -k2 -n
/sys/devices/system/cpu/cpu0/topology/thread_siblings_list 0,24
/sys/devices/system/cpu/cpu24/topology/thread_siblings_list 0,24
/sys/devices/system/cpu/cpu1/topology/thread_siblings_list 1,25
/sys/devices/system/cpu/cpu25/topology/thread_siblings_list 1,25
/sys/devices/system/cpu/cpu26/topology/thread_siblings_list 2,26
/sys/devices/system/cpu/cpu2/topology/thread_siblings_list 2,26
/sys/devices/system/cpu/cpu27/topology/thread_siblings_list 3,27
/sys/devices/system/cpu/cpu3/topology/thread_siblings_list 3,27
/sys/devices/system/cpu/cpu28/topology/thread_siblings_list 4,28
/sys/devices/system/cpu/cpu4/topology/thread_siblings_list 4,28
/sys/devices/system/cpu/cpu29/topology/thread_siblings_list 5,29
/sys/devices/system/cpu/cpu5/topology/thread_siblings_list 5,29
/sys/devices/system/cpu/cpu30/topology/thread_siblings_list 6,30
/sys/devices/system/cpu/cpu6/topology/thread_siblings_list 6,30
/sys/devices/system/cpu/cpu31/topology/thread_siblings_list 7,31
/sys/devices/system/cpu/cpu7/topology/thread_siblings_list 7,31
/sys/devices/system/cpu/cpu32/topology/thread_siblings_list 8,32
/sys/devices/system/cpu/cpu8/topology/thread_siblings_list 8,32
/sys/devices/system/cpu/cpu33/topology/thread_siblings_list 9,33
/sys/devices/system/cpu/cpu9/topology/thread_siblings_list 9,33
/sys/devices/system/cpu/cpu10/topology/thread_siblings_list 10,34
/sys/devices/system/cpu/cpu34/topology/thread_siblings_list 10,34
/sys/devices/system/cpu/cpu11/topology/thread_siblings_list 11,35
/sys/devices/system/cpu/cpu35/topology/thread_siblings_list 11,35
/sys/devices/system/cpu/cpu12/topology/thread_siblings_list 12,36
/sys/devices/system/cpu/cpu36/topology/thread_siblings_list 12,36
/sys/devices/system/cpu/cpu13/topology/thread_siblings_list 13,37
/sys/devices/system/cpu/cpu37/topology/thread_siblings_list 13,37
/sys/devices/system/cpu/cpu14/topology/thread_siblings_list 14,38
/sys/devices/system/cpu/cpu38/topology/thread_siblings_list 14,38
/sys/devices/system/cpu/cpu15/topology/thread_siblings_list 15,39
/sys/devices/system/cpu/cpu39/topology/thread_siblings_list 15,39
/sys/devices/system/cpu/cpu16/topology/thread_siblings_list 16,40
/sys/devices/system/cpu/cpu40/topology/thread_siblings_list 16,40
/sys/devices/system/cpu/cpu17/topology/thread_siblings_list 17,41
/sys/devices/system/cpu/cpu41/topology/thread_siblings_list 17,41
/sys/devices/system/cpu/cpu18/topology/thread_siblings_list 18,42
/sys/devices/system/cpu/cpu42/topology/thread_siblings_list 18,42
/sys/devices/system/cpu/cpu19/topology/thread_siblings_list 19,43
/sys/devices/system/cpu/cpu43/topology/thread_siblings_list 19,43
/sys/devices/system/cpu/cpu20/topology/thread_siblings_list 20,44
/sys/devices/system/cpu/cpu44/topology/thread_siblings_list 20,44
/sys/devices/system/cpu/cpu21/topology/thread_siblings_list 21,45
/sys/devices/system/cpu/cpu45/topology/thread_siblings_list 21,45
/sys/devices/system/cpu/cpu22/topology/thread_siblings_list 22,46
/sys/devices/system/cpu/cpu46/topology/thread_siblings_list 22,46
/sys/devices/system/cpu/cpu23/topology/thread_siblings_list 23,47
/sys/devices/system/cpu/cpu47/topology/thread_siblings_list 23,47
Isso significa que cpu0 e cpu24 compartilham o mesmo "endereço" de hardware físico. A mesma coisa para cpu1 e cpu25 ...
Então, basicamente, se eu quiser desativar o hyperthreading no meu sistema operacional linux, devo colocar '0' na CPU {24..47} / online com
for fake_cpu in {24..47}; do echo 0 > /sys/devices/system/cpu/cpu$fake_cpu/online;done
Você notará o quão interessante meu sistema está numerando os núcleos.
ht
sinalizador indica apenas que o multi-threading (HTT) é suportado pela CPU - não se estiver ativado ou não. Mesmo assim, nem sempre se pode confiar, por exemplo, indica falsamente que um i5 i5-6500 suporta HTT: ark.intel.com/content/www/us/en/ark/products/88184/…