Track explicit number of cachelines to be reparted

Instead of redunant calculating number of cachlines to be reparted, keep this
information in request's info

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2020-11-12 02:55:08 -05:00
parent 4329e617cf
commit e26ca30399
3 changed files with 29 additions and 1 deletions

View File

@ -128,6 +128,7 @@ void ocf_engine_update_req_info(struct ocf_cache *cache,
* Need to move this cache line into other partition * Need to move this cache line into other partition
*/ */
_entry->re_part = req->info.re_part = true; _entry->re_part = req->info.re_part = true;
req->info.re_part_no++;
} }
break; break;

View File

@ -47,6 +47,20 @@ static inline bool ocf_engine_is_hit(struct ocf_request *req)
*/ */
#define ocf_engine_is_miss(req) (!ocf_engine_is_hit(req)) #define ocf_engine_is_miss(req) (!ocf_engine_is_hit(req))
/**
* @brief Check if all the cache lines are assigned to a good partition
*
* @param req OCF request
*
* @retval true request's cache lines are assigned to a good partition
* @retval false some of the request's cache lines needs to be reassigned to
* a target partition
*/
static inline bool ocf_engine_needs_repart(struct ocf_request *req)
{
return req->info.re_part_no > 0;
}
/** /**
* @brief Check if all cache lines are mapped fully * @brief Check if all cache lines are mapped fully
* *
@ -98,6 +112,18 @@ static inline uint32_t ocf_engine_unmapped_count(struct ocf_request *req)
return req->core_line_count - (req->info.hit_no + req->info.invalid_no); return req->core_line_count - (req->info.hit_no + req->info.invalid_no);
} }
/**
* @brief Get number of cache lines to repart
*
* @param req OCF request
*
* @retval Number of cache lines to repart
*/
static inline uint32_t ocf_engine_repart_count(struct ocf_request *req)
{
return req->info.re_part_no;
}
/** /**
* @brief Get number of IOs to perform cache read or write * @brief Get number of IOs to perform cache read or write
* *

View File

@ -13,9 +13,10 @@
struct ocf_req_allocator; struct ocf_req_allocator;
struct ocf_req_info { struct ocf_req_info {
/* Number of hits, invalid, misses. */ /* Number of hits, invalid, misses, reparts. */
unsigned int hit_no; unsigned int hit_no;
unsigned int invalid_no; unsigned int invalid_no;
unsigned int re_part_no;
uint32_t dirty_all; uint32_t dirty_all;
/*!< Number of dirty line in request*/ /*!< Number of dirty line in request*/