OpenBSD Journal

Selectively block cores from the scheduler with sysctl hw.blockcpu

Contributed by rueda on from the not-flogging-a-wet-week dept.

We're a little late reporting it but…

The familiar safeguard sysctl hw.smt is now deprecated, having been replaced by a more flexible mechanism which allows discriminating between different varieties of core type.

First, Theo de Raadt (deraadt@) enabled the mechanism for OpenBSD/amd64 in this commit:

CVSROOT:	/cvs
Module name:	src
Changes by:	deraadt@cvs.openbsd.org	2026/03/31 10:46:22

Modified files:
	sys/sys        : sched.h sysctl.h 
	sys/kern       : kern_sched.c kern_sysctl.c 
	sys/arch/amd64/amd64: identcpu.c machdep.c 
	sys/arch/amd64/include: cpu.h 
	lib/libc/sys   : sysctl.2 

Log message:
Some new intel machines have a new 3rd tier of cpus called LP-E which are
E-core (Atom) without L3 cache.  These v are Lethargic, and it sucks
when processes migrate to them.
This introduces sysctl hw.blockcpu= which takes a sequence of 4 letters.
S (for SMT), P (regular performance cpu), E (efficient cpu) generally
80% to 50% as fast), and L (lethargic cpu) which are even slower.
By setting this, you can select cpus to kick out of the scheduler.  The
default is SL.
The hw.smt sysctl remains for now but we will eventually delete it.
hw.smt changes and follows hw.blockcpu=S.
ok kettenis mlarkin

Soon after, Mark Kettenis (kettenis@) added support on OpenBSD/arm64 in this commit:

CVSROOT:	/cvs
Module name:	src
Changes by:	kettenis@cvs.openbsd.org	2026/04/03 08:20:23

Modified files:
	sys/arch/amd64/amd64: machdep.c 
	sys/arch/arm64/arm64: cpu.c machdep.c 
	sys/arch/arm64/dev: acpicpu.c 
	sys/arch/arm64/include: cpu.h 

Log message:
Add hw.blockcpu support for arm64.  Here we classify CPU cores based on
their "capacity".  This a concept borrowed from the device tree standard
that indicates the nominal performance of a CPU core.  For ACPI machines
we use similar information from ACPI's Collaborative Processor Performance
Control (CPPC).  If performance is less than 30% of the fastest cores in
the same we classify them as L.  Between 30% and 80% we classify them as E.
And above 80% we classify them as P.  The CPU capacity is communicated to
userland though kstat(4).

ok deraadt@, jca@

Comments
  1. By John Lloyd (bitminer) j@bitminer.ca on

    Looking forward to a unique OpenBSD interpretation of cpusets, allowing assignment of processes to subsets of processors.

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]