AIX操作系统上的SMT技术 (转)
SMT技术不仅需要AIX操作系统支持,更需要power芯片硬件的支持,这种技术允许在一颗物理 CPU(core)上并发的的执行两个线程,通过这种技术可以大大提高CPU处理单元的利用率,一般可以使系统(CPU成为瓶颈的系统)性能提高30%以 上,下面用图示做一下对比:
--SMT关闭的情况下,CPU在一个CPU Cycle情况下处理单元的利用率
--SMT开启的情况下,CPU在一个CPU Cycle情况下处理单元的利用率
--利用smtctl命令查看当前Simultaneous Multi-Threading状态
test_db>#smtctl
This system is SMT capable.
SMT is currently enabled.
SMT boot mode is not set.
SMT threads are bound to the same physical processor.
proc0 has 2 SMT threads.
Bind processor 0 is bound with proc0
Bind processor 1 is bound with proc0
proc2 has 2 SMT threads.
Bind processor 2 is bound with proc2
Bind processor 3 is bound with proc2
--查看所有logical processors
test_db>#bindprocessor -q
The available processors are: 0 1 2 3
--查看可用的物理CPU(core)
test_db>#lsdev -Cc processor
proc0 Available 00-00 Processor
proc2 Available 00-02 Processor
test_db>#lsattr -El proc0
frequency 1654344000 Processor Speed False
smt_enabled true Processor SMT enabled False
smt_threads 2 Processor SMT threads False
state enable Processor state False
type PowerPC_POWER5 Processor type False
test_db>#lsattr -El proc2
frequency 1654344000 Processor Speed False
smt_enabled true Processor SMT enabled False
smt_threads 2 Processor SMT threads False
state enable Processor state False
type PowerPC_POWER5 Processor type False
也可以通过topas -L命令查看所有的逻辑CPU
test_db>#topas -L
Interval: 2 Logical Partition: Sat Sep 1 13:44:37 2007
Dedicated SMT ON Online Memory: 9728.0
Partition CPU Utilization Online Virtual CPUs: 2 Online Logical CPUs: 4
%user %sys %wait %idle
1 1 0 99
===============================================================================
LCPU minpf majpf intr csw icsw runq lpa scalls usr sys _wt idl pc
Cpu0 1134 0 261 76 45 0 100 801 2 2 0 96 0.52
Cpu1 0 0 14 0 0 0 0 0 0 0 0 100 0.48
Cpu2 230 0 107 125 65 0 100 198 0 1 0 99 0.52
Cpu3 0 0 15 0 0 0 0 0 0 0 0 100 0.48
--关闭SMT(重启后,系统仍然为SMT打开模式,要想永久关闭SMT,则可以用-w boot)
test_db>#smtctl -m off -w now
smtctl: SMT is now disabled.
test_db>#smtctl
This system is SMT capable.
SMT is currently disabled.
SMT boot mode is not set.
SMT threads are bound to the same physical processor.
proc0 has 1 SMT threads.
Bind processor 0 is bound with proc0
proc2 has 1 SMT threads.
Bind processor 1 is bound with proc2
test_db>#topas -L
Interval: 2 Logical Partition: Sat Sep 1 13:49:28 2007
Dedicated SMT OFF Online Memory: 9728.0
Partition CPU Utilization Online Logical CPUs: 2
%user %sys %wait %idle
0 0 0 100
===============================================================================
LCPU minpf majpf intr csw icsw runq lpa scalls usr sys _wt idl
Cpu0 0 0 256 110 60 0 100 17 0 0 0 100
Cpu2 0 0 104 100 50 0 100 20 0 0 0 100
--开启SMT
test_db>#smtctl -m on -w now
smtctl: SMT is now enabled.
test_db>#
test_db>#smtctl
This system is SMT capable.
SMT is currently enabled.
SMT boot mode is not set.
SMT threads are bound to the same physical processor.
proc0 has 2 SMT threads.
Bind processor 0 is bound with proc0
Bind processor 2 is bound with proc0
proc2 has 2 SMT threads.
Bind processor 1 is bound with proc2
Bind processor 3 is bound with proc2
test_db>#topas -L
Interval: 2 Logical Partition: Sat Sep 1 13:51:37 2007
Dedicated SMT ON Online Memory: 9728.0
Partition CPU Utilization Online Virtual CPUs: 2 Online Logical CPUs: 4
%user %sys %wait %idle
5 2 5 88
===============================================================================
LCPU minpf majpf intr csw icsw runq lpa scalls usr sys _wt idl pc
Cpu0 0 0 642 723 363 0 99 636 6 3 4 87 0.53
Cpu1 0 0 381 0 0 0 0 0 0 2 0 98 0.47
Cpu2 3 0 488 1374 688 0 100 1243 12 4 13 71 0.55
Cpu3 0 0 375 0 0 0 0 0 0 2 0 98 0.44
--可以通过smit smt图形化的引导界面操作SMT的打开与关闭
test_db>#smit smt
Simultaneous Multi-Threading Processor Mode
Move cursor to desired item and press Enter.
List SMT Mode Settings(查看当前的SMT模式,相当于执行smtctl命令)
Change SMT Mode
AIX操作系统默认情况下都会把SMT打开的,如果大家想修改SMT的状态,可以通过上面介绍的命令修改SMT的状态。