]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cohort_lru: keep strict discard, but from LRU
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 26 Nov 2025 23:17:02 +0000 (18:17 -0500)
committerDaniel Gryniewicz <dang@fprintf.net>
Fri, 29 May 2026 16:05:12 +0000 (12:05 -0400)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/common/cohort_lru.h

index 5ceb99094640f07ed98c1b18f62a5150bc0170cc..b8bc1eb143678fac0319f6b46a4f1d88fd1994bc 100644 (file)
@@ -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();