Skip to contentSkip to conversation

SMTCTL 0

PATCH New Andi Kleen 1 participant 2 messages Jun 7, 2018

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

cover SMTCTL 0

Here's an alternative proposal for SMT disabling.

I reimplemented my script as a C tool and put it into tools/*

# smtctl --enable
# smtctl --disable
# smtctl --print

Advantages:
- No kernel changes (although it would benefit from a minor one, see the commit)
- Much easier to use at runtime than opaque sysfs
- Encourages the right use model of only switching SMT state when it is actually needed and based on a conscious decision, not unnecessarily or globally.

Andi Kleen (1):
tools/smtctl: Add smtctl to enable/disable SMT at runtime

 tools/smtctl/Makefile |  10 ++
 tools/smtctl/smtctl.c | 257 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 267 insertions(+)
 create mode 100644 tools/smtctl/Makefile
 create mode 100644 tools/smtctl/smtctl.c
Signature · 1 line
2.14.3
author
#1 lore raw

PATCH 1/1 SMTCTL 1

Add a new tool called "smtctl" that allows to enable/disable SMT from the command line.

It supports --enable, --disable, --print, and a filter --cpus to only apply enable or disable to a subset of CPUs.

Open issue:
- The filtering only works for online CPUs because the kernel does not preserve the topology information for offlined CPUs. This could be fixed in the kernel.

---
 tools/smtctl/Makefile |  10 ++
 tools/smtctl/smtctl.c | 257 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 267 insertions(+)
 create mode 100644 tools/smtctl/Makefile
 create mode 100644 tools/smtctl/smtctl.c
tools/smtctl/Makefile new file +10 -0
new file mode 100644
index 000000000000..6457f5368e32
@@ -0,0 +1,10 @@
+PREFIX := /usr/local
+CFLAGS := -g -Wall -O2
+
+all: smtctl
+
+clean:
+	rm -f smtctl smtctl.o
+
+install:
+	cp smtctl ${PREFIX}/bin
tools/smtctl/smtctl.c new file +257 -0

257 lines not on this page · raw message

Signature · 1 line
2.14.3