gpu: fix STAGING pool cap leak and tighten idle snapshot/send pool caps on <=20GB RAM hosts
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
This commit is contained in:
1 parent
e4dbd89cd3
commit
604908e486
4 files changed
+17
-4
No files matched your search
@@ -1381,14 +1381,14 @@ fn snapshots_kept() -> usize {
|
||||
/// the largest, and of those the largest one and the next ones up to `KEPT`
|
||||
/// bytes in all.
|
||||
fn give_back(v: Vec<u8>) {
|
||||
const KEPT: usize = 512 << 20;
|
||||
let cap: usize = if crate::residency::tight_host_ram() { 128 << 20 } else { 512 << 20 };
|
||||
let mut pool = POOL.lock().unwrap_or_else(|e| e.into_inner());
|
||||
pool.push(v);
|
||||
pool.sort_by_key(|v| std::cmp::Reverse(v.capacity()));
|
||||
let (mut kept, mut total) = (0, 0usize);
|
||||
for v in pool.iter().take(snapshots_kept()) {
|
||||
total = total.saturating_add(v.capacity());
|
||||
if kept > 0 && total > KEPT {
|
||||
if kept > 0 && total > cap {
|
||||
break;
|
||||
}
|
||||
kept += 1;
|
||||
|
||||
Reference in new issue
Block a user