리눅스 하이퍼쓰레딩(Hyper Threading) 활성화 확인 방법

1. /proc/cpuinfo 활용

테스트용 VM에서 cat /proc/cpuinfo 해보면 아래와 같이 나온다.

[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model  : 42
model name : Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
stepping : 7
microcode : 0xffffffff
cpu MHz  : 3292.524
cache size : 6144 KB
physical id : 0
siblings : 1
core id  : 0
cpu cores : 1
apicid  : 0
initial apicid : 0
fpu  : yes
fpu_exception : yes
cpuid level : 13
wp  : yes
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm xsaveopt
bogomips : 6585.04
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

위 그림처럼 siblings 값과 cpu cores 값이 동일하면 하이퍼쓰레딩이 꺼져 있는 것이다. 만약 켜져 있다면 siblings 값이 cpu cores 값의 2배가 되어야 한다. 아래는 하이퍼쓰레딩이 켜져 있는 예시.


siblings 값과 cpu cores 값만 깔끔하게 보려면 아래와 같이 해보자.

egrep 'siblings|cpu cores' /proc/cpuinfo | head -2

2. dmidecode 활용

dmidecode -t processor 해보자.


위 그림처럼 Flags에 HTT (Multi-threading)가 있으면 활성화 된 것이다.(사실 Flags에서 찾는 방법은 /proc/cpuinfo에서도 유효하나 ht 라는 글자가 워낙에 작게 나와서 눈에 잘 안 띈다.)

또는 하단에 Core Count와 Thread Count를 명확하게 숫자로 보여주기 때문에, Thread Count 값이 Core Count 값의 2배이면 하이퍼쓰레딩이 켜져 있다고 판단할 수 있다.

마찬가지로 Core Count와 Thread Count 값만 보려면 아래와 같이 해보자.

dmidecode -t processor | egrep 'Core Count|Thread Count' | head -2

2014.06.20 추가
오늘 회사에서 겪은 일인데, /proc/cpuinfo와 dmidecode 정보를 100% 믿어서는 안 된다. 분명 인텔 홈페이지에는 Hyper Threading을 지원하지 않는 CPU라고 나오는데, cpuinfo와 dmideocde에는 ht, HTT가 표시되어 있었다.