Skip to content

fix: compare resize target against current allocator capacity - #466

Open
jeff3071 wants to merge 1 commit into
ovg-project:mainfrom
jeff3071:fix/resize-watcher-current-capacity
Open

fix: compare resize target against current allocator capacity#466
jeff3071 wants to merge 1 commit into
ovg-project:mainfrom
jeff3071:fix/resize-watcher-current-capacity

Conversation

@jeff3071

Copy link
Copy Markdown
Contributor

Summary

Fix the resize watcher failing to restore an allocator to its initial capacity after shrinking.

mem_size_per_layer_ stores the startup capacity and is not updated by resize(). The watcher therefore treated the initial limit as unchanged even when the allocator was currently smaller.

Use num_total_pages_ * page_size_ as the current allocator capacity instead.

Test

Added a regression test covering:

  1. Shrink from the initial capacity.
  2. Restore the original limit.
  3. Verify the watcher produces the expansion target.
  4. Verify the allocator returns to its initial page count.
python -m pytest -v  tests/test_kvcache_manager.py::test_resize_watcher_can_restore_initial_capacity

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.

1 participant