[Session] Skip the KV free when page alignment empties a streaming-session rewind (#43183)

Co-authored-by: Hanming Lu <69857889+hanming-lu@users.noreply.github.com>
Co-authored-by: Joshua Deng <91448271+joshuadeng@users.noreply.github.com>
This commit is contained in:
metamergebot
2026-10-08 20:40:25 -07:00
committed by GitHub
co-authored by Hanming Lu Joshua Deng
parent 4e3eaba619
commit 4ee3f0f370
2 changed files with 20 additions and 2 deletions
@@ -280,9 +280,9 @@ class StreamingSession:
def _free_kv_aligned(self, kv: ReqKvInfo, target: int, end: int) -> None:
"""Free [ceil_align(target), end): paged free returns whole pages, so
the partial page stays until release_session."""
if end <= target:
return
start = target
if self.cache.page_size > 1:
start = ceil_align(start, self.cache.page_size)
if end <= start:
return
self.cache.free_kv_row(kv, [(start, end)])