Parallel eviction
Eviction changes allowing to evict (remap) cachelines while holding hash bucket write lock instead of global metadata write lock. As eviction (replacement) is now tightly coupled with request, each request uses eviction size equal to number of its unmapped cachelines. Evicting without global metadata write lock is possible thanks to the fact that remaping is always performed while exclusively holding cacheline (read or write) lock. So for a cacheline on LRU list we acquire cacheline lock, safely resolve hash and consequently write-lock hash bucket. Since cacheline lock is acquired under hash bucket (everywhere except for new eviction implementation), we are certain that noone acquires cacheline lock behind our back. Concurrent eviction threads are eliminated by holding eviction list lock for the duration of critial locking operations. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -33,9 +33,13 @@ struct ocf_user_part_runtime {
|
||||
struct cleaning_policy cleaning;
|
||||
};
|
||||
|
||||
typedef bool ( *_lru_hash_locked_pfn)(void *context,
|
||||
ocf_core_id_t core_id, uint64_t core_line);
|
||||
|
||||
/* Iterator state, visiting all eviction lists within a partition
|
||||
in round robin order */
|
||||
struct ocf_lru_iter {
|
||||
struct ocf_lru_iter
|
||||
{
|
||||
/* cache object */
|
||||
ocf_cache_t cache;
|
||||
/* target partition */
|
||||
@@ -49,16 +53,30 @@ struct ocf_lru_iter {
|
||||
uint32_t num_avail_evps;
|
||||
/* current eviction list index */
|
||||
uint32_t evp;
|
||||
/* callback to determine whether given hash bucket is already
|
||||
* locked by the caller */
|
||||
_lru_hash_locked_pfn hash_locked;
|
||||
/* hash_locked private data */
|
||||
void *context;
|
||||
/* 1 if iterating over clean lists, 0 if over dirty */
|
||||
bool clean : 1;
|
||||
/* 1 if cacheline is to be locked for write, 0 if for read*/
|
||||
bool cl_lock_write : 1;
|
||||
};
|
||||
|
||||
#define OCF_EVICTION_CLEAN_SIZE 32U
|
||||
|
||||
struct ocf_part_cleaning_ctx {
|
||||
ocf_cache_t cache;
|
||||
struct ocf_refcnt counter;
|
||||
ocf_cache_line_t cline[OCF_EVICTION_CLEAN_SIZE];
|
||||
};
|
||||
|
||||
struct ocf_user_part {
|
||||
struct ocf_user_part_config *config;
|
||||
struct ocf_user_part_runtime *runtime;
|
||||
struct ocf_refcnt cleaning;
|
||||
ocf_part_id_t id;
|
||||
|
||||
struct ocf_lru_iter eviction_clean_iter;
|
||||
uint32_t next_eviction_list;
|
||||
struct ocf_part_cleaning_ctx cleaning;
|
||||
struct ocf_lst_entry lst_valid;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user