ht-manager: Disable Hyper Threading (and related technologies)
damentz
Status: Assistant
Joined: 09 Sep 2008
Posts: 740
Reply Quote
Hello everyone,

Available as of now on github is a new script I thought the rest of you would find useful. It's called ht-manager, or Hyper Threading Manager. All it does is let you turn on and off all logical cores at once:

github.com/damentz/ht-manager

For example, executing the script in this repository with --offline returns this output:

:: Code ::
$ sudo ht-manager.pl --offline
[sudo] password for damentz:
CPU topology:
cpu0: primary | online
cpu1: primary | online
cpu2: primary | online
cpu3: primary | online
cpu4: logical | online
cpu5: logical | online
cpu6: logical | online
cpu7: logical | online

Setting cpu4 to offline ... done!
Setting cpu5 to offline ... done!
Setting cpu6 to offline ... done!
Setting cpu7 to offline ... done!
[ ok ] Restarting irqbalance (via systemctl): irqbalance.service.

CPU topology:
cpu0: primary | online
cpu1: primary | online
cpu2: primary | online
cpu3: primary | online
cpu4: unknown | offline
cpu5: unknown | offline
cpu6: unknown | offline
cpu7: unknown | offline


Running ht-manager.pl with --online restores everything back to normal:

:: Code ::
$ sudo ht-manager.pl --online
[sudo] password for damentz:
CPU topology:
cpu0: primary | online
cpu1: primary | online
cpu2: primary | online
cpu3: primary | online
cpu4: unknown | offline
cpu5: unknown | offline
cpu6: unknown | offline
cpu7: unknown | offline

Setting cpu4 to online ... done!
Setting cpu5 to online ... done!
Setting cpu6 to online ... done!
Setting cpu7 to online ... done!
[ ok ] Restarting irqbalance (via systemctl): irqbalance.service.

CPU topology:
cpu0: primary | online
cpu1: primary | online
cpu2: primary | online
cpu3: primary | online
cpu4: logical | online
cpu5: logical | online
cpu6: logical | online
cpu7: logical | online


Running ht-manager.pl by itself will just show you your current topology (which you get output of before and after).

The benefits of disabling logical cores? Very workload specific - if you cannot risk two executions occurring on the same core where one task is considered high priority and the other low or idle, the only way to guarantee cpu time gets distributed accurately is to disable logical cores. With logical cores enabled, cpu time will be distributed evenly between both executions regardless of priority.

Throughput will drop but performance will be more predictable. That is the tradeoff you get when disabling hyperthreading, or the technology AMD uses on their Bulldozer cores and newer.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours