Use buddy_returns in memory LRU

parent 1e1a2ed8
......@@ -3104,7 +3104,6 @@ fellow_cache_obj_slim(const struct fellow_cache *fc,
static int
fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
{
buddy_t *buddy;
struct fellow_cache_seg *fcs, *fcss;
struct fellow_cache_obj *fco;
struct objcore *oc;
......@@ -3127,7 +3126,9 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
*/
CHECK_OBJ_NOTNULL(lru, FELLOW_CACHE_LRU_MAGIC);
buddy = lru->fc->membuddy;
struct buddy_returns *rets =
BUDDY_RETURNS_STK(lru->fc->membuddy, BUDDY_RETURNS_MAX);
alloc = buddy_ptr_extent_nil;
oc = NULL;
......@@ -3149,6 +3150,7 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
&alloc, lru);
AZ(pthread_mutex_unlock(&fco->mtx));
AZ(pthread_mutex_unlock(&lru->lru_mtx));
AN(buddy_return_ptr_extent(rets, &alloc));
fco = NULL;
break;
}
......@@ -3203,30 +3205,25 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
* so for fcs == NULL, we know we have iterated over
* all of the LRU
*/
if (fcs == NULL) {
if (fcs == NULL)
AZ(pthread_mutex_unlock(&lru->lru_mtx));
// VSLb(wrk->vsl, SLT_ExpKill, "LRU_Fail");
AZ(alloc.ptr);
AZ(alloc.ptr);
buddy_return(rets);
if (fcs == NULL) {
AZ(oc);
return (0);
}
/*
* at this point, we know we terminated the foreach
* with a break, so we either have an alloc return, or an FCO
* with a break. If we have an fco, we need to deref it.
*/
if (alloc.ptr != NULL) {
AZ(fco);
AN(alloc.size);
buddy_return1_ptr_extent(buddy, &alloc);
} else if (fco != NULL) {
if (fco != NULL) {
AN(oc);
// VSLb(wrk->vsl, SLT_ExpKill, "LRU x=%u", ObjGetXID(wrk, oc));
// we removed the oc's reference on fco in stvfe_mutate()
fellow_cache_obj_deref(lru->fc, fco);
} else {
INCOMPL();
}
return (1);
}
......
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