A linter for CPU pinning topologies. Pinning is not a guarantee — the OS scheduler, hardware IRQs and SMT will quietly defeat your carefully drawn core layout unless you verify it. pinlint checks that your declared "role → core" mapping doesn't lie: neither on paper (conflicts with the actual machine topology) nor at runtime (where your threads really run, and who is stealing your isolated cores).
Think ktlint, but for your CPU layout: rules with stable codes, severities,
exit codes for CI. Built for low-latency JVM systems (Aeron, Chronicle,
busy-spin threads on isolated cores), but it works on plain /proc and /sys,
so any Linux process qualifies.
Grab the static binary from Releases — no JVM needed:
curl -L -o pinlint https://github.com/Filipp931/pinlint/releases/latest/download/pinlint-linux-amd64
chmod +x pinlintSee what your machine actually looks like:
./pinlint topologyCPUs: 16 (0-15)
Socket 0:
core 0: cpus 0,8
core 1: cpus 1,9
core 2: cpus 2*,10*
core 3: cpus 3*,11*
Socket 1:
core 0: cpus 4,12
core 1: cpus 5,13
core 2: cpus 6,14
core 3: cpus 7,15
NUMA nodes:
node 0: 0-3,8-11
node 1: 4-7,12-15
L3 domains:
0-3,8-11 (8 cpus)
4-7,12-15 (8 cpus)
Isolated (isolcpus): 2-3,10-11
Tickless (nohz_full): 2-3,10-11
Live IRQs:
irq 125 (eth0-TxRx-0): cpus 0, 124533 interrupts
irq 126 (eth0-TxRx-1): cpus 2, 98211 interrupts
(1 idle irq hidden; --format json shows all)
(* = isolated cpu)
Declare your layout in a small YAML plan and lint it:
./pinlint check --plan plan.yml3 findings (2 warnings, 1 info)
PIN005 warning core 0 of role "gc-workers" services hardware IRQ 125 (eth0-TxRx-0, 124533 interrupts on this core so far)
PIN005 warning core 2 of role "market-data" services hardware IRQ 126 (eth0-TxRx-1, 98211 interrupts on this core so far)
PIN008 info exclusive roles "market-data" (core 2) and "order-gateway" (core 3) share L3 domain 0-3,8-11 — cache traffic of one evicts the other
That IRQ on core 2 is exactly the kind of thing that shows up as a mysterious latency spike three weeks into production. Now it's a lint warning.
Then point it at the live process and check reality:
./pinlint inspect --pid $(pgrep -f trading-engine) --plan plan.yml2 findings (2 errors)
PIN101 error thread "og-sender" (tid 41382) of role "order-gateway" last ran on cpu 7, expected 3
PIN102 error thread "og-sender" (tid 41382) of role "order-gateway" has affinity 0-15, wider than role cores 3 — pinning is not applied, the thread just happens to sit there right now
Exit codes: 0 clean, 1 findings at or above --fail-on (default error),
2 usage error. --format json for machines, colors auto-off when piped
(and --no-color / NO_COLOR for good measure).
// build.gradle.kts
implementation("io.github.filipp931:pinlint-core:0.1.0")A config with hardcoded core ids silently rots the first time the service moves
to different hardware — let the application refuse to start instead of
degrading quietly. pinlint-core has no dependencies beyond the Kotlin
stdlib and a Java-friendly API, so the same rules that power the CLI can run
in your startup path:
import io.github.filipp931.pinlint.Pinlint;
import io.github.filipp931.pinlint.plan.PinPlan;
PinPlan plan = PinPlan.load(Path.of("pin-plan.yml"));
Pinlint.requireClean(plan); // throws with the full list of error-level findings,
// and refuses to "pass" when no topology is readable at allNo YAML? Build the plan from your own config:
PinPlan plan = PinPlan.builder()
.process("trading-engine")
.addRole(Role.builder("market-data")
.thread("md-handler*")
.core(config.marketDataCore())
.exclusive(true)
.numaNode(0)
.build())
.addRole(Role.builder("gc-workers")
.thread("ZWorker*")
.cores(config.gcCores())
.build())
.build();
List<Finding> onThisMachine = Pinlint.check(plan); // topology read from /
List<Finding> onSnapshot = Pinlint.check(plan, topology); // or an explicit snapshot| Code | Severity | What it catches |
|---|---|---|
| PIN001 | error | Two exclusive roles pin the same core |
| PIN002 | error | Two exclusive roles on SMT siblings of one physical core — different cpu numbers, same execution units and L1/L2 |
| PIN003 | warning | An exclusive role's core is not in isolcpus — the scheduler will put strangers on it |
| PIN004 | info | An exclusive role's core is not in nohz_full — timer ticks will interrupt busy-spin loops |
| PIN005 | warning | A live hardware IRQ (non-zero counters) may fire on a role's core |
| PIN006 | warning | A role pins a core that does not exist on this machine, or is offline |
| PIN007 | info | A role declares a NUMA node but is pinned to a core of another node |
| PIN008 | info | Two exclusive roles share an L3 domain (a CCX on AMD EPYC) — sometimes intentional, always worth knowing |
| PIN101 | error | A matched thread last ran outside its role's cores |
| PIN102 | error | A matched thread's affinity mask is wider than its role's cores — pinning is not applied at all |
| PIN103 | warning | A foreign thread of the same process was seen on an exclusive role's core |
| PIN104 | warning | A role matched no threads — the pattern is stale |
| PIN105 | warning | Typical JVM background threads (ZWorker*, G1 *, C2 Comp*, VM Thread, ...) may run on isolated cores |
| PIN106 | warning | A thread is matched by more than one role — overlapping globs make per-role checks ambiguous |
PIN0xx are static (plan vs machine, check), PIN1xx are runtime
(plan vs live process, inspect).
# pinlint plan file
process: trading-engine # optional, used in messages
roles:
- name: market-data # unique role name
thread: "md-handler*" # glob over the thread name (comm); * and ? supported
core: 2 # exactly one core...
exclusive: true # ...that nobody else may touch
numaNode: 0 # optional: the NUMA node you believe this is on
- name: gc-workers
thread: "ZWorker*"
cores: [0, 1] # or a pool; also accepts cpulist syntax: "0-3,8"
exclusive: falseOne caveat the linter handles for you: the kernel truncates thread names to
15 characters (TASK_COMM_LEN). A pattern longer than that is matched against
the truncated form and pinlint prints a note about it, so
thread: "market-data-receiver*" still finds market-data-rec. The flip side:
a short suffix glob like "*-receiver" cannot match a thread whose suffix was
truncated away — anchor patterns at the start of the name.
Your plan should break the build when it drifts from the machine it deploys to. Capture the production topology once (or on every provisioning change):
# on the production box
./scripts/capture-topology.sh prod-box.tar.gz
# in your repo
mkdir -p topology/prod-box && tar -xzf prod-box.tar.gz -C topology/prod-boxThen lint against the snapshot in the pipeline — no access to production needed:
pinlint check --plan deploy/pin-plan.yml --root topology/prod-box --fail-on warningThe --root flag makes pinlint read sys/ and proc/ from a directory
instead of the live machine; the snapshot is a few KB of plain text files and
diffs beautifully in code review when the hardware changes.
check and inspect are point-in-time. watch answers the nastier question:
"something occasionally steals my isolated core — who?" It samples
nonvoluntary_ctxt_switches of your exclusive-role threads and, the moment a
delta appears, scans the whole system to name the intruder:
./pinlint watch --pid $(pgrep -f trading-engine) --plan plan.yml --interval 1s --duration 60swatching pid 41337 (2 exclusive roles: market-data, order-gateway) every 1s for 60s
[12:41:03] core 2 (market-data): "md-handler-0" preempted 3x; on this core now: kworker/2:1 (pid 312)
[12:41:27] core 2 (market-data): "md-handler-0" preempted 2x; on this core now: irqbalance (pid 1044)
--- summary ---
core 2 (isolated, market-data): preempted 47x in 60s; co-residents seen: kworker/2:1, irqbalance
isolated cpus on this machine: 2-3,10-11
A kworker on an isolated core usually means some subsystem still queues work
there; irqbalance means your IRQ affinity settings are being rewritten behind
your back. Either way, you now have a name instead of a histogram tail.
- rtla osnoise / hwnoise — kernel-level noise measurement. Runs its own
workload threads on the CPUs, needs root and tracefs, has no notion of your
plan.
pinlint watchis non-intrusive — it samples/procof your process and reads (never perturbs) the rest of/proconly when preemption is detected, to name the intruder — and it is plan-aware. Use rtla when you need deep noise forensics; use pinlint to verify your layout continuously. - TACC show_affinity, hwloc-ps — display current bindings, nothing more. No rules, no plan, no exit codes.
- tuna — interactive tuning tool; complements pinlint, does not lint.
- taskset, lstopo — the building blocks you already use to create the layout. pinlint automates the checklist you run in your head afterwards.
None of them will tell you "your two hot threads are SMT siblings" or "this IRQ landed on your busy-spin core 98211 times" in a form a CI job can fail on. That gap is why pinlint exists.
inspectandwatchare Linux-only (they read/proc).checkandtopologyrun anywhere against a--rootsnapshot.- Reading
/proc/<pid>of another user's process requires the same user or root; same for some IRQ affinity files on hardened kernels. - Thread names are matched against the kernel-truncated 15-character
comm(see the note in the plan format section). watchsamples; an interval-long gap can hide a single very short preemption. Shrink--intervalif you hunt sub-second ghosts.
./gradlew build # JVM build + tests (works on any OS)
./gradlew :pinlint-cli:nativeCompile # native binary (Linux + GraalVM)If you want the full story of why these rules exist — isolcpus, nohz_full, IRQ steering, SMT and friends — see the low-latency debugging cookbook.