Only acquire read lock to verify lru elem hotness
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
c04bfa3962
commit
9e98eec361
@ -527,12 +527,21 @@ void evp_lru_hot_cline(ocf_cache_t cache, ocf_cache_line_t cline)
|
||||
{
|
||||
struct lru_eviction_policy_meta *node;
|
||||
struct ocf_lru_list *list;
|
||||
bool hot;
|
||||
|
||||
node = &ocf_metadata_get_eviction_policy(cache, cline)->lru;
|
||||
if (node->hot)
|
||||
|
||||
OCF_METADATA_EVICTION_RD_LOCK(cline);
|
||||
hot = node->hot;
|
||||
OCF_METADATA_EVICTION_RD_UNLOCK(cline);
|
||||
|
||||
if (hot)
|
||||
return;
|
||||
|
||||
list = evp_get_cline_list(cache, cline);
|
||||
|
||||
OCF_METADATA_EVICTION_WR_LOCK(cline);
|
||||
|
||||
if (node->next != end_marker ||
|
||||
node->prev != end_marker ||
|
||||
list->head == cline || list->tail == cline) {
|
||||
@ -542,6 +551,8 @@ void evp_lru_hot_cline(ocf_cache_t cache, ocf_cache_line_t cline)
|
||||
/* Update LRU */
|
||||
add_lru_head(cache, list, cline);
|
||||
balance_lru_list(cache, list);
|
||||
|
||||
OCF_METADATA_EVICTION_WR_UNLOCK(cline);
|
||||
}
|
||||
|
||||
static inline void _lru_init(struct ocf_lru_list *list)
|
||||
|
@ -83,9 +83,7 @@ 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_WR_LOCK(line);
|
||||
evict_policy_ops[type].hot_cline(cache, line);
|
||||
OCF_METADATA_EVICTION_WR_UNLOCK(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user