From fc06ef92a0c15bf883023866b0e2f6d652842908 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Sat, 26 Jun 2021 18:44:47 +0200 Subject: [PATCH 1/5] Remove obsolete wrapper for lru_rm_cline Signed-off-by: Adam Rutkowski --- src/utils/utils_cache_line.c | 2 +- src/utils/utils_cache_line.h | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) 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 */ From 1a5d20156eece2a47e5fb1943cb4f3c441fdc5e8 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Sat, 26 Jun 2021 18:46:06 +0200 Subject: [PATCH 2/5] Renamve eviction_idx to lru_idx Signed-off-by: Adam Rutkowski --- src/ocf_lru.c | 4 ++-- src/ocf_queue_priv.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ocf_lru.c b/src/ocf_lru.c index 387303c..3462a9c 100644 --- a/src/ocf_lru.c +++ b/src/ocf_lru.c @@ -632,7 +632,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); @@ -724,7 +724,7 @@ 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); 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; From a9ab5fbafdcd7baf9b6753a8f1cc531e74ecef2c Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Sat, 26 Jun 2021 18:54:09 +0200 Subject: [PATCH 3/5] Fix comments in ocf_engine_common.h Signed-off-by: Adam Rutkowski --- src/engine/engine_common.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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); From d029b2a2be89a628c90a38124d3bd63d6158bc2e Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Sat, 26 Jun 2021 18:59:23 +0200 Subject: [PATCH 4/5] Remove unused pending_eviction_clines counter Signed-off-by: Adam Rutkowski --- src/ocf_cache_priv.h | 2 -- src/ocf_lru.c | 13 ------------- src/ocf_seq_cutoff.c | 2 +- src/ocf_space.h | 2 -- 4 files changed, 1 insertion(+), 18 deletions(-) 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 3462a9c..c769b78 100644 --- a/src/ocf_lru.c +++ b/src/ocf_lru.c @@ -657,16 +657,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) { @@ -730,9 +720,6 @@ uint32_t ocf_lru_req_clines(struct ocf_request *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_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; From a7581b892cdf4d7e06360f8c7f76e8fc94b2f33d Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Sat, 26 Jun 2021 19:02:25 +0200 Subject: [PATCH 5/5] Rename evp_iter to lru_iter in concurrency Signed-off-by: Adam Rutkowski --- src/concurrency/ocf_metadata_concurrency.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; }