From e84af3a9a3d1e2d395a28c08cf1035fabbe8a65e Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Wed, 26 Nov 2025 18:17:02 -0500 Subject: [PATCH] cohort_lru: keep strict discard, but from LRU Signed-off-by: Matt Benjamin --- src/common/cohort_lru.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/cohort_lru.h b/src/common/cohort_lru.h index 5ceb9909464..b8bc1eb1436 100644 --- a/src/common/cohort_lru.h +++ b/src/common/cohort_lru.h @@ -240,11 +240,14 @@ namespace cohort { } else { lane.q.erase(it); } + lane.q.push_front(*o); /* hiwat check */ - if (lane.q.size() > lane_hiwat) { - tdo = o; - } else { - lane.q.push_front(*o); + if (lane.q.size() > lane_hiwat) { + /* discard the actual lane LRU immediately */ + Object* o2 = &(lane.q.back()); + Object::Queue::iterator it = Object::Queue::s_iterator_to(*o2); + lane.q.erase(it); + tdo = o2; } } lane.lock.unlock(); -- 2.47.3