diff --git a/src/concurrency/ocf_metadata_concurrency.c b/src/concurrency/ocf_metadata_concurrency.c index 953ee9b..52059a0 100644 --- a/src/concurrency/ocf_metadata_concurrency.c +++ b/src/concurrency/ocf_metadata_concurrency.c @@ -10,12 +10,12 @@ int ocf_metadata_concurrency_init(struct ocf_metadata_lock *metadata_lock) { int err = 0; - unsigned evp_iter; + unsigned lru_iter; unsigned part_iter; unsigned global_iter; - for (evp_iter = 0; evp_iter < OCF_NUM_LRU_LISTS; evp_iter++) - env_rwlock_init(&metadata_lock->lru[evp_iter]); + for (lru_iter = 0; lru_iter < OCF_NUM_LRU_LISTS; lru_iter++) + env_rwlock_init(&metadata_lock->lru[lru_iter]); for (global_iter = 0; global_iter < OCF_NUM_GLOBAL_META_LOCKS; global_iter++) { @@ -40,8 +40,8 @@ global_err: while (global_iter--) env_rwsem_destroy(&metadata_lock->global[global_iter].sem); - while (evp_iter--) - env_rwlock_destroy(&metadata_lock->lru[evp_iter]); + while (lru_iter--) + env_rwlock_destroy(&metadata_lock->lru[lru_iter]); return err; } diff --git a/src/engine/engine_common.h b/src/engine/engine_common.h index 239549b..06f54db 100644 --- a/src/engine/engine_common.h +++ b/src/engine/engine_common.h @@ -67,7 +67,7 @@ static inline bool ocf_engine_needs_repart(struct ocf_request *req) * @param req OCF request * * @retval true request is mapped fully - * @retval false request is not mapped fully and eviction might be run in + * @retval false request is not mapped fully and remap might be run in * order to complete mapping */ static inline bool ocf_engine_is_mapped(struct ocf_request *req) @@ -226,9 +226,10 @@ struct ocf_engine_callbacks * * @param req OCF request * - * @returns eviction status - * @retval LOOKUP_INSERTED successfully evicted required number of cachelines - * @retval LOOKUP_MISS eviction failure + * @returns cacheline lock status + * @retval OCF_LOCK_ACQUIRED in case of success and CLs locked + * @retval OCF_LOCK_NOT_ACQUIRED in case of success and waiting for CL lock + * @retval <0 other error code */ int ocf_engine_prepare_clines(struct ocf_request *req); diff --git a/src/ocf_cache_priv.h b/src/ocf_cache_priv.h index 858ba8c..5d713b5 100644 --- a/src/ocf_cache_priv.h +++ b/src/ocf_cache_priv.h @@ -105,8 +105,6 @@ struct ocf_cache { env_atomic pending_read_misses_list_blocked; env_atomic pending_read_misses_list_count; - env_atomic pending_eviction_clines; - env_atomic flush_in_progress; env_mutex flush_mutex; diff --git a/src/ocf_lru.c b/src/ocf_lru.c index 707e725..edd09ca 100644 --- a/src/ocf_lru.c +++ b/src/ocf_lru.c @@ -633,7 +633,7 @@ void ocf_lru_clean(ocf_cache_t cache, struct ocf_user_part *user_part, } ctx->cache = cache; - lru_idx = io_queue->eviction_idx++ % OCF_NUM_LRU_LISTS; + lru_idx = io_queue->lru_idx++ % OCF_NUM_LRU_LISTS; lock_idx = ocf_metadata_concurrency_next_idx(io_queue); ocf_metadata_start_shared_access(&cache->metadata.lock, lock_idx); @@ -658,16 +658,6 @@ void ocf_lru_clean(ocf_cache_t cache, struct ocf_user_part *user_part, ocf_cleaner_fire(cache, &attribs); } -bool ocf_lru_can_evict(ocf_cache_t cache) -{ - if (env_atomic_read(&cache->pending_eviction_clines) >= - OCF_PENDING_EVICTION_LIMIT) { - return false; - } - - return true; -} - static void ocf_lru_invalidate(ocf_cache_t cache, ocf_cache_line_t cline, ocf_core_id_t core_id, ocf_part_id_t part_id) { @@ -725,15 +715,12 @@ uint32_t ocf_lru_req_clines(struct ocf_request *req, ENV_BUG_ON(req->part_id == PARTITION_FREELIST); dst_part = &cache->user_parts[req->part_id].part; - lru_idx = req->io_queue->eviction_idx++ % OCF_NUM_LRU_LISTS; + lru_idx = req->io_queue->lru_idx++ % OCF_NUM_LRU_LISTS; lru_iter_eviction_init(&iter, cache, src_part, lru_idx, req); i = 0; while (i < cline_no) { - if (!ocf_lru_can_evict(cache)) - break; - if (src_part->id != PARTITION_FREELIST) { cline = lru_iter_eviction_next(&iter, dst_part, &core_id, &core_line); diff --git a/src/ocf_queue_priv.h b/src/ocf_queue_priv.h index ad27571..def5d08 100644 --- a/src/ocf_queue_priv.h +++ b/src/ocf_queue_priv.h @@ -18,8 +18,8 @@ struct ocf_queue { /* per-queue free running global metadata lock index */ unsigned lock_idx; - /* per-queue free running eviction list index */ - unsigned eviction_idx; + /* per-queue free running lru list index */ + unsigned lru_idx; struct ocf_seq_cutoff *seq_cutoff; diff --git a/src/ocf_seq_cutoff.c b/src/ocf_seq_cutoff.c index dabf0db..b6f4e33 100644 --- a/src/ocf_seq_cutoff.c +++ b/src/ocf_seq_cutoff.c @@ -11,7 +11,7 @@ #include "ocf/ocf_debug.h" #include "utils/utils_cache_line.h" -#define SEQ_CUTOFF_FULL_MARGIN OCF_PENDING_EVICTION_LIMIT +#define SEQ_CUTOFF_FULL_MARGIN 512 static inline bool ocf_seq_cutoff_is_on(ocf_cache_t cache, struct ocf_request *req) diff --git a/src/ocf_space.h b/src/ocf_space.h index 51b7fa6..61383db 100644 --- a/src/ocf_space.h +++ b/src/ocf_space.h @@ -10,8 +10,6 @@ #include "ocf_lru.h" #include "ocf_lru_structs.h" -#define OCF_PENDING_EVICTION_LIMIT 512UL - #define OCF_NUM_LRU_LISTS 32 struct ocf_part; diff --git a/src/utils/utils_cache_line.c b/src/utils/utils_cache_line.c index 8be264e..879c0fc 100644 --- a/src/utils/utils_cache_line.c +++ b/src/utils/utils_cache_line.c @@ -45,7 +45,7 @@ static void __set_cache_line_invalid(struct ocf_cache *cache, uint8_t start_bit, */ if (!is_valid && !ocf_cache_line_are_waiters( ocf_cache_line_concurrency(cache), line)) { - ocf_purge_eviction_policy(cache, line); + ocf_lru_rm_cline(cache, line); ocf_metadata_remove_cache_line(cache, line); } } diff --git a/src/utils/utils_cache_line.h b/src/utils/utils_cache_line.h index ec9510b..30581c1 100644 --- a/src/utils/utils_cache_line.h +++ b/src/utils/utils_cache_line.h @@ -170,18 +170,6 @@ static inline void ocf_purge_cleaning_policy(struct ocf_cache *cache, cleaning_policy_ops[clean_type].purge_cache_block(cache, line); } -/** - * @brief Remove cache line from eviction policy - * - * @param cache - cache instance - * @param line - cache line to be removed - */ -static inline void ocf_purge_eviction_policy(struct ocf_cache *cache, - ocf_cache_line_t line) -{ - ocf_lru_rm_cline(cache, line); -} - /** * @brief Set cache line clean and invalid and remove form lists * @@ -206,8 +194,8 @@ static inline void _ocf_purge_cache_line_sec(struct ocf_cache *cache, } /** - * @brief Purge cache line (remove completely, from collision, move to free - * partition, from cleaning policy and eviction policy) + * @brief Purge cache line (remove from collision and cleaning policy, + * move to free LRU list). * * @param req - OCF request to purge */