Skip to content

feat(memory): add shared budget and RSS admission foundations - #910

Merged
iaojnh merged 25 commits into
alibaba:mainfrom
iaojnh:codex/shared-budget-rss-foundation-upstream-20261117
Nov 18, 2026
Merged

iaojnh merged 25 commits into
alibaba:mainfrom
iaojnh:codex/shared-budget-rss-foundation-upstream-20261117

Conversation

@iaojnh

@iaojnh iaojnh commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Shared-cache budgets currently omit allocator bookkeeping, so the configured limit can understate retained native memory. Managed workspaces also need a common ownership-aware RSS admission path.

This PR adds the shared budget and RSS admission foundation:

  • Account for eviction queues, slab headers, retained blocks, registered workspaces and pending allocations. Release backing charges only after successful physical release.
  • Separate native capacity, RSS/materialization demand and waiter priority. Preserve prepaid capacity and validate resident-overlap proofs against ownership and observation changes.
  • Unify bounded admission waits with background reclamation and residency confirmation, including idle-backing recovery during maintenance callbacks.
  • Add budget-aware allocators, buffers and reservations, with accounting, lifecycle, pressure and cross-DSO coverage. Update workload tests to include allocator metadata in their budgets.

RSS admission is opt-in and remains a sampled soft target.

Validation

  • Fork CI: 18/18 checks passed on 6f09fb78, covering Linux/musl, macOS, Windows, Android and iOS.
  • macOS ARM64, macOS x64 and Linux ARM64: all 60 storage tests passed in each environment; the shared-reserve regression passed 100 consecutive runs per environment.
  • Disabling page-admission headroom makes the shared-reserve regression fail, verifying that it detects a loss of protection.

The branch is synchronized with current upstream main; the Snowball workaround from #907 is reused unchanged.

Expire asynchronous ownership proofs on host pressure changes without
advancing allocation observation epochs. This also covers an ABA pressure
cycle whose final state is unchanged.

Let queue slabs with fully charged backing use their reserved future fault
cost. Classify mappings present during aggregate startup exclusion as
potentially excluded, atomically with the exclusion; later mappings keep
their own full backing coverage across RSS disable/re-enable.

Validate the same regressions against 9464bd6 and the fixed runtime,
including real Linux page loss and queue allocations. The fixed build
passes 124 focused cases, 70,560 lifecycle schedules, 39 ASan/UBSan cases,
25 macOS consumer compile checks and four changed-unit static checks.
Separate native growth priority from RSS/proof waiter notification. Use one
admission loop for fixed allocations, prepaid process backing and retained
mapping reuse, checking full RSS demand and an elapsed-time retry deadline.
Keep multi-batch reclaim working across logical release and backing discard.

Verify 103 admission boundary combinations, delayed proof with concurrent
required pages, retry pacing and retained reuse. Four controls fail or time
out against 9afbab9 and pass with the unified implementation.
Keep maintenance admission nonblocking while allowing idle backing to be
released. Restore ownership proof after discard expires the RSS observation,
and prevent recursive owner reclaim for both waiting and nonwaiting calls.

Cover seven allocation paths across idle/full native capacity and enabled/
disabled RSS, including real aligned, vector, mapped and retained allocators.
The identical regression fails on 7aee126 and passes with this change.
@iaojnh
iaojnh merged commit 93a6660 into alibaba:main Nov 18, 2026
19 checks passed
iaojnh added a commit to iaojnh/zvec that referenced this pull request Nov 18, 2026
Adopt the shared-budget and RSS foundation from alibaba#910, keep Buffer Pool ownership and bounded I/O behavior at its consumers, and migrate the non-vector benchmarks to their new directory.

Preserve mandatory admission progress when live owners release capacity in stages. Validate the merge with the native Buffer Pool, storage, Flat, IVF and DiskANN suites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants