Add promotion policy API and use it in I/O path

Promotion policy is supposed to perform ALRU noise filtering by
eliminating one-hit wonders being added to cache and polluting it.

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial
2019-07-11 12:19:29 +02:00
parent 999f3f7245
commit 917cbd859a
20 changed files with 409 additions and 21 deletions

View File

@@ -193,7 +193,7 @@ typedef enum {
} ocf_seq_cutoff_policy;
/**
* OCF supported eviction types
* OCF supported eviction policy types
*/
typedef enum {
ocf_eviction_lru = 0,
@@ -206,6 +206,23 @@ typedef enum {
/*!< Default eviction policy */
} ocf_eviction_t;
/**
* OCF supported promotion policy types
*/
typedef enum {
ocf_promotion_nop = 0,
/*!< No promotion policy. Cache inserts are not filtered */
ocf_promotion_nhit,
/*!< Line can be inserted after N requests for it */
ocf_promotion_max,
/*!< Stopper of enumerator */
ocf_promotion_default = ocf_promotion_nop,
/*!< Default promotion policy */
} ocf_promotion_t;
/**
* OCF supported Write-Back cleaning policies type
*/

View File

@@ -262,6 +262,11 @@ struct ocf_mngt_cache_config {
*/
ocf_eviction_t eviction_policy;
/**
* @brief Promotion policy type
*/
ocf_promotion_t promotion_policy;
/**
* @brief Cache line size
*/
@@ -313,6 +318,7 @@ static inline void ocf_mngt_cache_config_set_default(
cfg->name = NULL;
cfg->cache_mode = ocf_cache_mode_default;
cfg->eviction_policy = ocf_eviction_default;
cfg->promotion_policy = ocf_promotion_default;
cfg->cache_line_size = ocf_cache_line_size_4;
cfg->metadata_layout = ocf_metadata_layout_default;
cfg->metadata_volatile = false;