Architecture Decision Records
ADR 0068: Memory-limited partitions share a card with processes outside the platform by the memory left
On this page
Date: 2026-11-16 · Status: Accepted, amended 2026-11-17 and 2026-11-21, amended again 2026-11-21 (item 16) (supplements ADR 0060)
Context
When a card has compute processes the platform did not start (a vLLM a user started, another orchestrator's container), the agent reports them as foreign_processes and the server treats the card as taking no deployment at all: its memory is held by something the platform can neither see nor plan around, and a whole-card deployment would run out of memory at startup.
A memory-limited dGPU partition (nvidia-dgpu and others) only ever wants part of a card, though, and the agent reports how much memory each of those processes holds. A real case: on a 143771 MiB H20-3e, another orchestrator's container held 63982 MiB, and a 50 GiB partition deployment was refused outright; after foreign_processes was cleared by hand, it ran stably beside that container on the same card.
Relaxing the server alone is not enough: the agent's rule for processes outside the platform is "while a card holds none of this node's instances, every process on it is foreign", and once a platform instance is on the card it stops examining it. The foreign processes vanish from the next report, the server takes the card for empty, and hands out what is left as if it were all of it.
Decision
- Only partitions share, admitted by memory. When a card is held by processes outside the platform, every one of their memory figures is known, the card is healthy and an operator has not stopped scheduling on it, a memory-limited deployment may be placed there: memory available = total − what the outside processes hold − headroom − what the platform's instances already claim (sleeping residue included), and it is admitted only if that covers the deployment's limit plus the partition overhead (
estimate.PartitionClaimBytes). A whole-card deployment is still refused;store.GPU.CanTakeWorkkeeps its meaning, so fleet statistics and SQL aggregates are unaffected; in the scheduling center's card states, a held card a platform instance serves on counts as serving, and any other held card still counts as held by a process outside the platform. The same figure is used when a running partition's quota is changed in place (planning.QuotaRoom) and for the GPU list's available memory (planning.ForeignHold); on a held card whose foreign use is unknown, a quota changed in place may shrink but not grow, and the GPU list shows no available memory, rather than reading the unknown as nothing held. Usage analytics count a held card as schedulable capacity for GPU time only when the scheduler can actually place a partition there (sharing applies, the agent is at the level of item 5, and a partition backend is ready on the card,planning.PartitionMayShareHeldCard), since the partitions' time is charged to it. On a held card an operator has explicitly enabled until manually disabled, a whole-card deployment is still admitted against whole-card capacity (total memory × utilization) without the foreign memory taken off, andno_fitcarries the foreign parameters only for a capacity that took them off. - Headroom:
estimate.ForeignHeadroomBytes= 5% of the card, at least 4 GiB, the same shape as the host-memory headroom of an L1 sleep. What the outside processes hold is a reading taken once a minute, not a limit they keep to, and an out-of-memory failure costs both sides. - Unknown means no sharing: a process without a memory figure, a holder that is not a process (a card Kubernetes gave to another pod, which has no PID), or a list that cannot be read all count as unknown use, and the card stays refused.
- On a shared card the agent counts foreign processes by slots: once a platform instance is on the card, the agent no longer examines it in full; but when the card is shared with processes it had found to be foreign, it still reads it every round. Each of the platform's engines keeps one process on a card (the sleep residue reading relies on the same rule), so as many processes as there are platform instances on the card are the platform's own. A process found to be foreign that is still in the list under its PID and process name stays foreign, reported with its current memory (with its last figure when the tool gives none this round); a process already taken for a platform engine stays the platform's; the other new processes first fill the slots of platform engines whose process is not known yet, and any beyond them are foreign—a job the outside user starts beside ours, or a workload the other orchestrator restarted under a new PID. When more new processes appear at once than there are free slots, the ones holding the most are counted foreign: overstating the outside use only refuses a placement, understating it runs a partition out of memory. A foreign process no longer in the list is not reported, but its memory is not offered at once: when no foreign process is left on the card, the card is still released only after 3 free readings in a row, so neither the gap of an exit or a restart under a new PID nor a PID-less entry carried over a reboot stays reported for as long as a platform instance is on the card. A card once shared is read this way for as long as the platform instances stay, so a foreign workload that comes back after being released is found again. When every platform instance on the card sleeps or has left, the card is examined in full again. A round whose probe or process list fails restates the last answer rather than clearing it. The foreign record is kept in the agent's state directory (
card-occupancy.json) and survives an agent restart or upgrade (the processes taken for platform engines live only in memory and are taken again by slots after a restart); when the file was last written before the running boot started (btimein/proc/stat, and likewise when that cannot be read) the PIDs mean nothing, so they are dropped as it is read: those processes are matched against no live process, so a platform instance process that happens to get the same PID is not taken for a foreign one, and the card is read afresh by the rule above in the next round. The check uses only the file's existing modification time, and the file format is unchanged. It lives only on the agent and is not a new persisted fact on the server. - Gated by agent capability: sharing is open only to an agent that does item 4, judged from the node's already-reported
partition_safety_protocollevel, refreshed by every report:proto.PartitionSafetyForeignTracked(2) means the agent keeps reporting outside processes when a partition shares their card. It is the next level of the same partition safety contract (level 1 is native vdev ownership); a higher level includes the lower ones, and rolling an agent back revokes new sharing at the next report. Partitions already placed on a held card are not protected by that: the older agent stops reporting the card's outside processes, and the server then takes the card for free and places deployments against all of its memory. Before rolling an agent back below level 2, stop the partitions placed on held cards. No column is added. - Sleep: a wake onto a card held outside the platform is still refused; to be consistent, a deployment that sleeps is not placed on such a card either, refused with
held_outside_platform_sleep, or once asleep it could never be woken there. - Say why: for a request that names its cards, the filters look only at the named cards, so a held card is reported as
gpus_held_outside_platformrather than "no free GPU"; when memory is short,no_fitcarriesforeign_bytes/foreign_giband the headroom parameters so the UI can explain the figures. Whether the card can be picked in the deploy form follows the server's per-card verdict for the current request (gpu_candidates); the frontend does not restate the rule.
Amended 2026-11-17 (items 8–12): a partition isolates memory only; compute and bandwidth are still shared with load the platform cannot see, so users can see an unexplained inference slowdown. Sharing a card therefore takes consent, and clean cards always come first.
- A node placement policy switch, off by default: the node's placement policy (
nodepolicy.Policy, the node row'splacement_*columns;nodepolicy.Settingsdrives the dictionaryGET /scheduling/node-placement-policies,PATCH /nodes/{uuid}/placement-policyand the DTO) has a knobshare_with_foreign, off by default. Off, automatic placement does not use a held card, which is the behaviour before this ADR; the refusalheld_outside_platform_not_allowedcarriessetting(the knob's key),gpus,countandnode, and the UI shows the knob by its own name. The same code is reported when the node has a clean card that is busy or too small: when a schedule fails and cards were withheld by a gate that can be consented to, the scheduler plans once more in memory as if consented, and reports this code if the request would then be placed, or the reason that would remain if not (turning the switch on would not help). Usage analytics count a held card as schedulable capacity only on a node with the switch on (planning.PartitionMayShareHeldCard); the memory counted for the outside processes does not depend on the switch. The switch is the operator's intent, which no existing data implies, so it is one new column (migration 218). Writing a knob is not refused by applicability: on a node without a ready partition backend, or whose agent is below the level of item 5,placement_policy_availabilitymarks it as having no effect, with a reason code. - Card gates and card preferences: sharing is a card gate of the scheduler that can be consented to (
scheduler.cardGate) and does not change the card's capability bits:ForeignShareablestill means "can be shared", the gate decides "may be shared", and the order of the gate table is the order of refusal reasons (the sleep gate first, which consent never lifts). "Clean cards first" is the first card preference (scheduler.cardPreferences): table order is precedence, and tiers relax in lexicographic order of the table, the degraded preference first and sharing last, giving "healthy and clean → degraded but clean → healthy but shared → any". A plan that uses shared cards carriesforeign_shared_gpus_used{gpus,count,foreign_gib}. A cleaner tier wins over a shared plan the catalog prefers more. Across nodes, only a concession of the sharing kind (poolWide) makes the controller's pool placement and the deploy form's automatic preview (both throughplanning.FitPicker) keep looking, within the trial budget, for a node with a clean card; with none, the shared fallback is taken, before waiting for holders to yield; a degraded card is still first fit. A replica an operator asked to start on a named node (lifecycle.Orders.HintPlacement) goes there whenever it fits: preferences rank the nodes the scheduler chooses, they do not overrule a node the operator named. - Picking the cards is consent: consent comes only from the
gpuskey of a deployment's placement (planning.Placement.OperatorPinned, not automatic placement), and likewise from thegpusof a PD unit or multi-node rank (units[].gpus,followers[].gpus, carried into that rank's placement byplanning.PDRankLaunch.Apply), since the platform's own unit picks and node replacements name nodes, never cards: with the switch off, a manual placement on a held card that fits by memory is admitted. Any API caller pinning cards withgpus(the AI assistant's generic API tool and scripts included) consents; thegpu_indexesan older client echoes back does not, nor do card indexes the platform fills in itself (per-card capability probes, unit suggestions, a replica the pool places elsewhere). The deploy form's card list is judged as the operator picking, and notes a shared card withforeign_shared_card. Whole-card requests and cards whose outside memory is unknown are refused as before. - Switching off evicts nothing: it affects new placements only. A re-placement (rolling restart, failure replacement, scale-up) follows the new value: before a rolling restart drains a partition on a held card, it previews the replacement on that node without the instance (
planning.Input.ExcludeInstanceUUID), and when the switch refuses it the roll waits and recordsheld_outside_platform_not_allowedrather than drop the replica; a replacement after a crash cannot be previewed and goes pending with the switch off, its reason naming the switch. A pool deployment whose requirements do not pin the replica to one node is not previewed: its replacement is picked across the pool (pickPoolNode), so its own node's refusal says nothing about where the replacement goes; when no node in the pool takes it, the replacement goes pending with its reason naming the switch. - Instance notes on shared cards: an instance whose cards are shared with processes outside the platform carries a note (
dto.Instance.notes,INSTANCE_CARD_SHARED_OUTSIDE{gpu_indexes,foreign_bytes,foreign_gib}, orINSTANCE_CARD_SHARED_OUTSIDE_UNKNOWNwhen their memory is not known). Only an instance still on its cards carries one: a finished one (proto.InstanceFinishedStates: stopped, failed, pending_removal) does not, one draining or being removed does. Notes are derived by a rule table when the instance is read (deployment.InstanceNotes), never stored and never kept per instance: a note appears at the next read after the outside processes are reported, goes when they are released, and nothing is left when the instance is removed. It states the fact, whatever the protocol level or how the instance was placed. Outside processes that start later depend on the agent: an agent atproto.PartitionSafetyForeignTrackedPartitioned(3) also reads a card holding only partition instances by the slot rule of item 4 (one process per partition engine on the card), so a later process is reported too. When the agent first reads such a card (just upgraded from a lower level, or a job started beside ours while it restarted) and finds more processes than our engines keep, none known, which are ours is a guess: the ones holding the most count as foreign (overstating rather than understating), but the guess is not taken as knowledge - the next reading weighs them afresh and the state file keeps them without their PIDs - so once the outside job leaves, an engine of ours counted foreign in its place is ours again and the note goes after the release rounds. Not covered: outside processes that start later on a card holding a whole-card instance (a whole-card engine keeps no fixed number of processes, and counting would misjudge it), and agents below level 3.
Amended 2026-11-21 (items 13–15, superseding items 8 and 11 and rewriting "who lifts the gate" in item 9): the node placement policy switch and a card's "Enable scheduling" (ADR 0060, store.SetCardScheduling) are two entrances to one decision: once scheduling is enabled on a held card the card itself takes work (store.GPU.CanTakeWork), the gate no longer asks, and the node switch has no say over it. Two layers of consent mean "why may this card be used or not" is answered in two places, and an operator looking at a card marked as used outside the platform does not find the switch to change beside it. So only the card's own remains.
- Consenting to automatic sharing is enabling scheduling on the card: the node placement policy is removed (the
nodepolicypackage, the node row'splacement_share_with_foreigncolumn,PATCH /nodes/{uuid}/placement-policy,GET /scheduling/node-placement-policies, the node DTO'splacement_policyandplacement_policy_availability). Migration 246 drops the column and 219 is retired to a no-op. A node that had the switch on is not converted into enabled cards: enabling scheduling admits whole-card deployments, which is wider than the switch was, and the platform does not widen it on the operator's behalf; running instances are unaffected and new placements go back to not sharing automatically. Item 10 stands: picking the cards is still consent for that one deployment, still bound by items 1, 3, 5 and 6. - The gate honours only the request's consent:
foreignSharingGatelets a card through only when the request picked its cards (scheduler.Consent.CardsChosen); the refusalheld_outside_platform_not_allowedcarriesgpus,countandnodeand no longersetting, and the UI points at "Enable scheduling" on those cards from them. A held card with scheduling enabled isSchedulableand reaches neither this gate nor the sleep gate: enabling scheduling is the operator's explicit decision about the card, and the platform no longer guards it by items 1, 3, 5 and 6, so whole-card deployments, cards whose outside use is unknown and nodes whose agent is below item 5's level are all placed on. A node with an older agent drops the outside processes once the first instance is on the card (the misjudgement item 5 describes); the UI prompts for an agent upgrade rather than the scheduler refusing. Usage analysis counts a held card as schedulable capacity accordingly when scheduling is enabled on it (CanTakeWork), andplanning.PartitionMayShareHeldCardis removed. - An enabled held card still comes after clean cards: the first card preference becomes the card that would be shared with outside processes whose memory is counted (
GPU.sharesForeignNow: held, withheld by no gate,ForeignBytes > 0, shareable or enabled), so after enabling, clean cards are still used first, a node with a clean card is still looked for across the pool, and a plan that uses the card still carriesforeign_shared_gpus_used. An enabled card whose outside use is unknown has no figure to state and is not in this tier. This supersedes item 11: a card has no "consent withdrawn" state, only disabled scheduling, which for any card means no new work and evicts nothing. The rolling restart's precheck (rollReplacementRefused) stays, and now applies when outside processes took the card after the replica was placed and nobody enabled the card; it stops and recordsheld_outside_platform_not_allowedwithout taking the replica down.
Amended again 2026-11-21 (item 16, rewriting "how much the headroom is" in item 2): on a 22 GiB card the headroom is 4 GiB, 18% of the card; and when the outside process is an inference engine that takes its memory once at startup (vLLM, SGLang), its memory no longer grows and that headroom is withheld for nothing. The platform cannot tell which kind an outside process is; the operator knows.
- The deployment policy decides the headroom: the share and the minimum of
estimate.ForeignHeadroomBytes(total, share, minimum)come from the deployment policy (foreign_headroom_pctandforeign_headroom_min_bytesof thedeploymentsetting,store.DeploymentPolicy). The shipped values remain 5% and 4 GiB, the ranges are 0–50% and 0–64 GiB, and both at 0 keeps no headroom. It is one value for the whole cluster, not set per node or per card: a per-card headroom is the "whether a card can take a placement is decided in two places" that item 13 just removed. The planner writes the headroom onto held cards in the snapshot (scheduler.GPU.ForeignHeadroomBytes); the scheduler reads no setting. Admission, a quota change in place (planning.QuotaRoom) and the allocatable memory of the GPU list (planning.ForeignHold) use the same value. A change applies to later placements and evicts nothing: after raising it, partitions already on the card keep running, and the card's allocatable memory follows the new value, 0 when it does not fit. With no headroom kept,no_fitcarries no headroom parameters. The GPU list also reportsforeign_bytes(the outside processes' memory that is counted), from which the memory allocation chart draws the outside processes' memory and the headroom apart, and draws no headroom when none is kept. The settings page states the consequence when both values are 0. It is the operator's intent and cannot be derived from existing data; it is stored in the existing deployment policy JSON, with no new column or migration, and an older value lacking the two keys reads the shipped values.
Trade-offs
- The agent still does not match processes to containers by cgroup: that needs PID-namespace handling per runtime and per vendor tool, and a wrong answer stops a card the platform is using. A shared card is read by the slot rule of one process per engine per card instead: an outside process that appears while a platform instance is on the card but before its engine's process is up takes that slot and is taken for the platform's; an engine that runs more than one process on a card has the extra ones counted as foreign, which admits less. Only cards that were shared with foreign processes are read this way; other cards of platform instances are still not examined.
- PID plus process name may take a new process of the same name for the original one when a PID is reused, and that new process's memory is then reported; within one boot this is rare, and across boots PIDs are no longer matched.
- After an outside process exits, the card keeps counting its last figure for 3 readings and only then offers it. A workload whose restart takes longer counts as free in between, and is counted foreign again as a new process when it comes back.
- The headroom is a fixed share rather than the outside processes' historical peak: a peak would need a new persisted fact, and 5%/4 GiB covers the reading fluctuation observed; an operator can still stop scheduling on the card. (2026-11-21: an administrator can adjust the share and the minimum, see item 16; the historical peak is still not used.)
- The headroom is not set per card or per node, nor decided from the kind of outside process: the first is the second switch item 13 removed, and the second needs the platform to recognise "this process will not grow", which a process name does not say, while a wrong guess costs both sides an out-of-memory failure.
- Nodes with an older agent cannot share until upgraded: better to ask for an agent upgrade than to take the card for free after the first placement. (2026-11-21: this holds only for picked cards; for cards with scheduling enabled see item 14.)
- This ADR supersedes the former deferred item T68 in
known-issues.md("cards held by outside processes are only excluded whole"). - Consent is not folded into the capability bit
ForeignShareable: folded in, nothing downstream could tell "cannot be shared" from "is not allowed to be shared", a manual pick would have nothing to override, and the refusal could not say which switch to turn on. - "Clean cards first" is a preference tier rather than a score penalty:
scorePlanscompares only plans of different TP, and the group within a TP is already chosen by topology, so a penalty could not change which card is used. - Degraded cards do not make the pool keep looking: that would change today's first-fit placement on every node with a degraded card, and a degraded card is one the platform sees and watches.
- A held card gets no state narrower than "Enable scheduling" (one that admits only partitions and keeps item 5's agent check): that would be a third card state, with operators telling "enabled" from "enabled for sharing only", which is the complexity this amendment removes; the cost is that enabling admits more on a held card, which the confirmation states and the UI's agent-upgrade prompt covers.
- No node-level bulk entrance is kept as data: several held cards on one node are enabled one by one; where a bulk action is wanted the UI sends the same card action for several cards, and no node field is added.
- The consent retry costs one more in-memory plan only for a schedule that failed; the preference tiers are at most 2^n plans (at most 4 entries), and a tier is tried only when the one before it is empty.
Was this page helpful?