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:
Adam Rutkowski
2021-03-05 11:20:47 +01:00
parent 1411314678
commit 81fc7ab5c5
20 changed files with 694 additions and 330 deletions

View File

@@ -33,6 +33,9 @@ struct ocf_req_info {
uint32_t mapping_error : 1;
/*!< Core lines in this request were not mapped into cache */
uint32_t clean_eviction : 1;
/*!< Eviction failed, need to request cleaning */
uint32_t core_error : 1;
/*!< Error occured during I/O on core device */
@@ -104,6 +107,7 @@ struct ocf_request {
/*!< OCF IO associated with request */
const struct ocf_engine_callbacks *engine_cbs;
/*!< Engine owning the request */
env_atomic ref_count;
/*!< Reference usage count, once OCF request reaches zero it
@@ -396,6 +400,16 @@ static inline bool ocf_req_test_mapping_error(struct ocf_request *req)
return req->info.mapping_error;
}
static inline void ocf_req_set_clean_eviction(struct ocf_request *req)
{
req->info.clean_eviction = true;
}
static inline bool ocf_req_test_clean_eviction(struct ocf_request *req)
{
return req->info.clean_eviction;
}
/**
* @brief Return OCF request reference count
*