A numactl-like launcher for per-process cache aware scheduling
control, built on prctl(PR_SCHED_CACHE) (the
cache_aware_dev_prctl kernel series).
llcctl sets the requested attributes on itself, marks them as
inheritable across execve(), and executes the command. Because
fork() children always inherit the attributes and the inherit mask
survives both fork() and execve(), the whole process tree of the
command runs with the given settings. Nested invocations compose (the
inherit bits are OR-ed).
make # needs any libc; kernel headers optional
# (uapi constants have a built-in fallback)
llcctl [options] [--] command [args...]
llcctl --show
| option | attribute | meaning |
|---|---|---|
-e / -d |
PR_SCHED_CACHE_ENABLE |
opt in / out while the feature is globally on |
-n, --tolerance-nr=N |
AGGR_TOLERANCE_NR |
allow ~N running threads per physical core of one LLC (0..100, default) |
-s, --tolerance-size=N |
AGGR_TOLERANCE_SIZE |
memory footprint tolerance (0..100, default) |
-p, --overaggr-pct=N |
OVERAGGR_PCT |
LLC busy threshold, percent of LLC capacity (0..1000, default) |
-S, --show |
print the calling process's attributes |
default (or -1) resets an attribute to follow the global debugfs
knobs under /sys/kernel/debug/sched/llc_balancing/.
# opt a memory-bandwidth-hungry workload out of aggregation, so
# its threads spread across LLCs and use their combined bandwidth
llcctl -d -- ./membw-hungry
# pack a Verilator-style job: up to ~2 threads per physical core
# in one LLC, LLC considered non-busy up to 100% of capacity
llcctl -n 2 -p 100 -- make -j16
# inspect what a shell inherited
llcctl --show
- The effective thread cutoff is roughly
0.8 * N * cores + 3per LLC (the 0.8 isfits_capacity()headroom, the +3 the EWMA rounding), e.g. on an 8c/16t LLC:-n 1≈ 9 threads,-n 2≈ 15. - Attributes only take effect while the feature is globally enabled
(
llc_balancing/enabled = 1) on hardware with multiple LLCs;llcctlcannot turn the feature on by itself. - Exit codes follow
env(1): 125 llcctl error, 126 command not executable, 127 command not found.
GPL-2.0-only, the same license as the Linux kernel — see COPYING.