Skip to content

fix: Reclaim paged blocks during decode when the pool budget is exhausted #1982

Closed

Description

@inureyes

Problem

Found while reviewing PR #1978. With the paged backend and the default --kv-cache-budget (Auto), prefill admission reclaims blocks: admit_paged_prefill (src/server/batch/scheduler/admission.rs:723) calls reclaim_paged_blocks (admission.rs:696), which evicts prompt-cache entries via store.evict_one_lru() and then preempts running sequences. Decode has no equivalent. When a decoding sequence crosses a block boundary, acquire_block (src/lib/mlxcel-core/src/cache/paged.rs:2445) returns "PagedBlockPool: block budget exhausted" and the request errors.

Prompt-cache paged entries pin pool blocks and count against the budget (free_block_budget = budget - live_block_count, paged.rs:814). #1978 raised the default prompt-cache store capacity (model-aware), so decode growth is now more likely to hit the limit while cached entries hold blocks.

Fix

Before each decode step, the scheduler computes the blocks the step will mint (sequences crossing a block boundary) and calls the existing reclaim_paged_blocks(need), so reclaim order is prompt-cache LRU first, then the existing preemption policy. Reuse that function; do not add a second eviction loop. A request errors only if both fail. Integrate this in the real scheduler decode path.

Acceptance Criteria

  • Unit test: fill the pool with cached prompt entries, then decode a sequence past a block boundary; it succeeds and an LRU entry is evicted (fails on current code).
  • Unit test: with no evictable entries, the decode falls back to preemption instead of returning the budget error.
  • With free budget, no eviction or preemption occurs (existing tests unchanged).

Activity

  1. added
    status:ready
    type:bug
    priority:medium
    status:in-progress
    status:review
    and removed
    status:ready
    status:in-progress
    on Sep 26, 2026
  2. added a commit that references this issue on Sep 30, 2026
  3. added
    status:done
    and removed
    status:review
    on Sep 30, 2026
  4. added a commit that references this issue on Oct 2, 2026
    929c80a
  5. added this to the 0.8 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumstatus:donetype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions