Optimize eviction of subsequent segments of the same object

parent 4019cc1b
......@@ -3134,6 +3134,7 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
oc = NULL;
fco = NULL;
AZ(pthread_mutex_lock(&lru->lru_mtx));
//lint -e{850} loop variable modified in body
VTAILQ_FOREACH_SAFE(fcs, &lru->lru_head, lru_list, fcss) {
// no use trying the same object again and again
if (fcs->fco == fco)
......@@ -3146,10 +3147,22 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
continue;
}
if (fcs->state == FCS_INCORE) {
fellow_cache_lru_seg_evict_locked(fcs,
&alloc, lru);
do {
fellow_cache_lru_seg_evict_locked(fcs,
&alloc, lru);
AN(buddy_return_ptr_extent(rets, &alloc));
if (rets->size < lru->fc->membuddy->deficit &&
fcss != NULL &&
fcss->state == FCS_INCORE &&
fcss->fco == fco) {
fcs = fcss;
fcss = VTAILQ_NEXT(fcs, lru_list);
continue;
}
} while (0);
AZ(pthread_mutex_unlock(&fco->mtx));
AN(buddy_return_ptr_extent(rets, &alloc));
fco = NULL;
if (rets->size < lru->fc->membuddy->deficit)
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment