Change eviction spin lock to RW lock

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2021-02-05 16:05:20 -06:00
parent 1908707a3d
commit 9690f13bef
5 changed files with 31 additions and 35 deletions

View File

@@ -578,12 +578,12 @@ void evp_lru_clean_cline(ocf_cache_t cache, struct ocf_user_part *part,
clean_list = evp_lru_get_list(part, ev_list, true);
dirty_list = evp_lru_get_list(part, ev_list, false);
OCF_METADATA_EVICTION_LOCK(cline);
OCF_METADATA_EVICTION_WR_LOCK(cline);
remove_lru_list(cache, dirty_list, cline);
balance_lru_list(cache, dirty_list);
add_lru_head(cache, clean_list, cline);
balance_lru_list(cache, clean_list);
OCF_METADATA_EVICTION_UNLOCK(cline);
OCF_METADATA_EVICTION_WR_UNLOCK(cline);
}
void evp_lru_dirty_cline(ocf_cache_t cache, struct ocf_user_part *part,
@@ -596,11 +596,11 @@ void evp_lru_dirty_cline(ocf_cache_t cache, struct ocf_user_part *part,
clean_list = evp_lru_get_list(part, ev_list, true);
dirty_list = evp_lru_get_list(part, ev_list, false);
OCF_METADATA_EVICTION_LOCK(cline);
OCF_METADATA_EVICTION_WR_LOCK(cline);
remove_lru_list(cache, clean_list, cline);
balance_lru_list(cache, clean_list);
add_lru_head(cache, dirty_list, cline);
balance_lru_list(cache, dirty_list);
OCF_METADATA_EVICTION_UNLOCK(cline);
OCF_METADATA_EVICTION_WR_UNLOCK(cline);
}

View File

@@ -36,9 +36,9 @@ static inline void ocf_eviction_purge_cache_line(
ENV_BUG_ON(type >= ocf_eviction_max);
if (likely(evict_policy_ops[type].rm_cline)) {
OCF_METADATA_EVICTION_LOCK(line);
OCF_METADATA_EVICTION_WR_LOCK(line);
evict_policy_ops[type].rm_cline(cache, line);
OCF_METADATA_EVICTION_UNLOCK(line);
OCF_METADATA_EVICTION_WR_UNLOCK(line);
}
}
@@ -83,9 +83,9 @@ static inline void ocf_eviction_set_hot_cache_line(
ENV_BUG_ON(type >= ocf_eviction_max);
if (likely(evict_policy_ops[type].hot_cline)) {
OCF_METADATA_EVICTION_LOCK(line);
OCF_METADATA_EVICTION_WR_LOCK(line);
evict_policy_ops[type].hot_cline(cache, line);
OCF_METADATA_EVICTION_UNLOCK(line);
OCF_METADATA_EVICTION_WR_UNLOCK(line);
}
}
@@ -97,9 +97,9 @@ static inline void ocf_eviction_initialize(struct ocf_cache *cache,
ENV_BUG_ON(type >= ocf_eviction_max);
if (likely(evict_policy_ops[type].init_evp)) {
OCF_METADATA_EVICTION_LOCK_ALL();
OCF_METADATA_EVICTION_WR_LOCK_ALL();
evict_policy_ops[type].init_evp(cache, part);
OCF_METADATA_EVICTION_UNLOCK_ALL();
OCF_METADATA_EVICTION_WR_UNLOCK_ALL();
}
}