New locking paradigm for fellow_cache_lru_work

parent 565503af
...@@ -2988,7 +2988,17 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru) ...@@ -2988,7 +2988,17 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
struct buddy_ptr_extent alloc; struct buddy_ptr_extent alloc;
int r; int r;
//lint --e{456} flexelint does not grok trylock /*lint --e{454,455,456}
*
* flexelint does not understand the locking structure here:
*
* - it dies not understand trylock
* - we leave the loop either with break
* - mtx unlocked
* - fcs != NULL
* - or foreach finishes, then fcs == NULL and the mtx
* needs to be unlocked
*/
CHECK_OBJ_NOTNULL(lru, FELLOW_CACHE_LRU_MAGIC); CHECK_OBJ_NOTNULL(lru, FELLOW_CACHE_LRU_MAGIC);
buddy = lru->fc->membuddy; buddy = lru->fc->membuddy;
...@@ -3012,6 +3022,7 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru) ...@@ -3012,6 +3022,7 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
fellow_cache_lru_seg_evict_locked(fcs, fellow_cache_lru_seg_evict_locked(fcs,
&alloc, lru); &alloc, lru);
AZ(pthread_mutex_unlock(&fco->mtx)); AZ(pthread_mutex_unlock(&fco->mtx));
AZ(pthread_mutex_unlock(&lru->lru_mtx));
fco = NULL; fco = NULL;
break; break;
} }
...@@ -3024,6 +3035,7 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru) ...@@ -3024,6 +3035,7 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
/* mutate was successful /* mutate was successful
* VSC_C_main->n_lru_nuked++; // XXX per lru ? * VSC_C_main->n_lru_nuked++; // XXX per lru ?
*/ */
AZ(pthread_mutex_unlock(&lru->lru_mtx));
break; break;
} }
oc = NULL; oc = NULL;
...@@ -3033,9 +3045,9 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru) ...@@ -3033,9 +3045,9 @@ fellow_cache_lru_work(struct worker *wrk, struct fellow_cache_lru *lru)
AZ(pthread_mutex_unlock(&fco->mtx)); AZ(pthread_mutex_unlock(&fco->mtx));
WRONG("fcs state in lru"); WRONG("fcs state in lru");
} }
AZ(pthread_mutex_unlock(&lru->lru_mtx));
if (fcs == NULL) { if (fcs == NULL) {
AZ(pthread_mutex_unlock(&lru->lru_mtx));
// VSLb(wrk->vsl, SLT_ExpKill, "LRU_Fail"); // VSLb(wrk->vsl, SLT_ExpKill, "LRU_Fail");
AZ(alloc.ptr); AZ(alloc.ptr);
AZ(oc); AZ(oc);
......
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