Keep deep sharing generation within host memory guards

This commit is contained in:
2026-11-24 16:12:37 +08:00
parent 453b2ff787
commit c53d78b4aa
6 changed files with 15 additions and 11 deletions
+3 -2
View File
@@ -109,8 +109,9 @@ class StreamingLM:
rate = (count-self.swap_observation[1])*4096/elapsed
self.swap_pressure_windows = self.swap_pressure_windows+1 if rate > 4*1024**2 else 0
own_swap_kib = int(status.get('VmSwap', '0 kB').split()[0])
if self.swap_pressure_windows >= 3 and (
available < 384*1024 or own_swap_kib > self.process_swap_limit_kib):
over_process_limit = (self.process_swap_limit_kib is not None
and own_swap_kib > self.process_swap_limit_kib)
if self.swap_pressure_windows >= 3 and (available < 384*1024 or over_process_limit):
raise MemoryError(f'Sustained host swap pressure plus constrained memory: available={available} KiB, process_swap={own_swap_kib} KiB')
self.swap_observation = (now,count)
if rss_kib > 512*1024 or available < 256*1024: