nx_model_lane_core.nx
buildroot/runtime/nx_model_lane_core.nx
about
nx_model_lane_core.nx -- SOVEREIGN MODEL-LANE LEASE (pure core, no main; CLI = nx_model_lane,
gate = nx_model_lane_gate). Eats the 2026-07-16 bug class: multiple sessions launching
model-scale workloads (11-12GB dequant caches) into one WSL VM -> kernel OOM storm / VM
collapse (dmesg: nx_forge_bestof OOM-killed alongside the 1.5B serve). The Nishi-owned cure:
ONE lane lease file gates model-scale launches on this worker -- claim BEFORE launching,
free after. Composes the proven idioms: O_EXCL create = the lock (dl_lock/rt_lock lineage,
kernel-guaranteed single creator, no TOCTOU) + holder record stamped INTO the lease +
staleness = holder-pid dead (via /proc/<pid>/comm) OR age>ttl + /proc/meminfo MemAvailable
HEADROOM CHECK (nx_resource_arbiter DENIED_NO_BUDGET semantics at the file level: a FREE
lane still refuses a claim the box cannot back).
rc map: 0 ok · 10 held-by-other (live holder printed) · 11 headroom-denied ·
12 bad-args · 13 free-refused-not-holder · 14 lease-corrupt (fail-loud, never steal).
Record: holder|est_mb|pid|epoch_us|ttl_sec\n (pid = the WORKLOAD's pid, callers pass $$,
never the claim CLI's own pid -- the CLI exits immediately).
license_tier: ORIGINAL
dependencies 2 imports · 8 importers
imports: nx_syscalls.nxnx_lib_std.nx
imported by: nx_claim_core.nxnx_deploy_leash.nxnx_model_lane.nxnx_model_lane_gate.nxnx_pid_diag.nxnx_rv64_const_probe.nxnx_swarm_admit.nxnx_swarm_queue.nx
structs
| none |
consts
| 19 | const ML_LEASE_DEFAULT: *u8 = "knowledge/status/model_lane.lease" |
| 20 | const ML_OEXCL: i64 = 193 // O_CREAT|O_EXCL|O_WRONLY (dl lineage) |
| 21 | const ML_MODE: i64 = 420 // 0644 |
| 22 | const ML_FLOOR_MB: i64 = 2048 // headroom floor the CLI enforces above est_mb |
functions
| 24 | func ml_unlink(path: *u8) -> i64 { return __syscall(263, AT_FDCWD, path as i64, 0, 0, 0, 0) } |
| 34 | func ml_ncores() -> i64 |
| 62 | func ml_load1() -> i64 |
| 80 | func ml_load_over(load1: i64, load_max: i64) -> i64 |
| 88 | func ml_meminfo_avail_mb() -> i64 called by 3: ml_claimsa_admit_livesq_telem_ok calls 5: sys_mmapsys_openat_rdsys_readsys_closestd_slen |
| 128 | func ml_pid_alive(pid: i64) -> i64 called by 7: dl_walkml_claimmainsq_scansq_heavy_holderstend_reap+1 calls 4: sys_mmapstd_itoasys_openat_rdsys_close |
| 148 | func ml_parse(buf: *u8, n: i64, hbuf: *u8, f: *i64) -> i64 |
| 195 | func ml_try_create(path: *u8, holder: *u8, est_mb: i64, pid: i64, ttl_sec: i64) -> i64 |
| 224 | func ml_claim(path: *u8, holder: *u8, est_mb: i64, pid: i64, ttl_sec: i64, floor_mb: i64) -> i64 |
| 288 | func ml_free(path: *u8, holder: *u8) -> i64 |
| 314 | func ml_status(path: *u8) -> i64 |