pub fn acquire_build_reservation(
cli_label: &str,
cpu_cap: Option<CpuCap>,
) -> Result<BuildReservation>Expand description
Acquire the two-phase reservation (LLC flocks + cgroup sandbox)
for a kernel OR harness build. Factored out of
kernel_build_pipeline so integration tests can exercise the
cpu_cap → acquire → sandbox → make_jobs decision tree without
requiring a real kernel source tree, and so cargo-ktstr’s
harness-compile warm-up (bin/cargo_ktstr/run_cargo.rs) can take
the identical reservation before a colocated runner’s cargo
build invades a perf-mode LLC reservation. pub for that
cross-binary reuse; the escape hatches (KTSTR_BYPASS_LLC_LOCKS,
KTSTR_CARGO_TEST_MODE inside acquire_llc_plan), degraded-sysfs
warn/hard-error gating, and cgroup-degrade semantics are shared
verbatim between both callers.
Returns a BuildReservation whose fields are the three values
kernel_build_pipeline used to bind inline. _sandbox is
declared first and drops first per Rust’s declaration-order
field-drop rule; this ensures the cgroup sandbox is removed
before the LLC flock is released.
cli_label prefixes operator-facing error text.
cpu_cap is the resolved CPU-count cap from
CpuCap::resolve;
None means “reserve 30% of the calling process’s allowed-CPU
set”, applied inside the planner at acquire time.