Skip to content

Idle instance pins GBs beyond MAX_CACHED_TOKENS due to cached-block fragmentation across 2MB pages, starving co-located instances #359

Description

@cui36

With prefix caching enabled, an instance that has gone idle retains far more physical GPU memory than the KVCACHED_MAX_CACHED_TOKENS bound implies, measured ~8.9 GiB pinned vs. the nominal ~2.2 GiB (16000 tokens) on Qwen3-4B. Cached blocks are retained in place, scattered across the 2MB pages they were originally allocated from, and free_pages() can only unmap a page when it is completely empty. The pinned set is therefore bounded by pages touched, not tokens cached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions