MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / _ARC_replace

Function _ARC_replace

libCacheSim/cache/eviction/ARC.c:519–536  ·  view source on GitHub ↗

the REPLACE function in the paper */

Source from the content-addressed store, hash-verified

517
518/* the REPLACE function in the paper */
519static void _ARC_replace(cache_t *cache, const request_t *req) {
520 ARC_params_t *params = (ARC_params_t *)(cache->eviction_params);
521
522
523 bool cond1 = params->L1_data_size > 0;
524 bool cond2 = params->L1_data_size > params->p;
525 bool cond3 =
526 params->L1_data_size == params->p && params->curr_obj_in_L2_ghost;
527 bool cond4 = params->L2_data_size == 0;
528
529 if ((cond1 && (cond2 || cond3)) || cond4) {
530 // delete the LRU in L1 data, move to L1_ghost
531 _ARC_evict_L1_data(cache, req);
532 } else {
533 // delete the item in L2 data, move to L2_ghost
534 _ARC_evict_L2_data(cache, req);
535 }
536}
537
538/* finding the eviction candidate in _ARC_evict_miss_on_all_queues, but do not
539 * perform eviction */

Callers 2

ARC_evictFunction · 0.85

Calls 2

_ARC_evict_L1_dataFunction · 0.85
_ARC_evict_L2_dataFunction · 0.85

Tested by

no test coverage detected