Merge pull request #674 from robertbaldyga/prequeue-sequential-cutoff
Per-queue sequential cutoff support
This commit is contained in:
commit
7628474adf
@ -564,6 +564,9 @@ static struct cas_param cas_core_params[] = {
|
||||
.name = "Sequential cutoff policy",
|
||||
.value_names = seq_cutoff_policy_values,
|
||||
},
|
||||
[core_param_seq_cutoff_promotion_count] = {
|
||||
.name = "Sequential cutoff promotion request count threshold",
|
||||
},
|
||||
{0},
|
||||
};
|
||||
|
||||
@ -632,6 +635,7 @@ static struct cas_param cas_cache_params[] = {
|
||||
#define SEQ_CUT_OFF_THRESHOLD_DESC "Sequential cutoff activation threshold [KiB]"
|
||||
#define SEQ_CUT_OFF_POLICY_DESC "Sequential cutoff policy. " \
|
||||
"Available policies: {always|full|never}"
|
||||
#define SEQ_CUT_OFF_PROMO_COUNT_DESC "Sequential cutoff stream promotion request count threshold"
|
||||
|
||||
#define CLEANING_POLICY_TYPE_DESC "Cleaning policy type. " \
|
||||
"Available policy types: {nop|alru|acp}"
|
||||
@ -664,6 +668,7 @@ static cli_namespace set_param_namespace = {
|
||||
CORE_PARAMS_NS_BEGIN("seq-cutoff", "Sequential cutoff parameters")
|
||||
{'t', "threshold", SEQ_CUT_OFF_THRESHOLD_DESC, 1, "KiB", 0},
|
||||
{'p', "policy", SEQ_CUT_OFF_POLICY_DESC, 1, "POLICY", 0},
|
||||
{0, "promotion-count", SEQ_CUT_OFF_PROMO_COUNT_DESC, 1, "NUMBER", 0},
|
||||
CORE_PARAMS_NS_END()
|
||||
|
||||
CACHE_PARAMS_NS_BEGIN("cleaning", "Cleaning policy parameters")
|
||||
@ -741,6 +746,12 @@ int set_param_seq_cutoff_handle_option(char *opt, const char **arg)
|
||||
cas_printf(LOG_ERR, "Error: Invalid policy name.\n");
|
||||
return FAILURE;
|
||||
}
|
||||
} else if (!strcmp(opt, "promotion-count")) {
|
||||
if (validate_str_num(arg[0], "sequential cutoff promotion request count", 1,
|
||||
65535) == FAILURE)
|
||||
return FAILURE;
|
||||
|
||||
SET_CORE_PARAM(core_param_seq_cutoff_promotion_count, atoi(arg[0]));
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
@ -973,6 +984,7 @@ int get_param_namespace_handle_option(char *namespace, char *opt, const char **a
|
||||
if (!strcmp(namespace, "seq-cutoff")) {
|
||||
SELECT_CORE_PARAM(core_param_seq_cutoff_threshold);
|
||||
SELECT_CORE_PARAM(core_param_seq_cutoff_policy);
|
||||
SELECT_CORE_PARAM(core_param_seq_cutoff_promotion_count);
|
||||
return core_param_handle_option_generic(opt, arg,
|
||||
get_param_handle_option);
|
||||
} else if (!strcmp(namespace, "cleaning")) {
|
||||
|
@ -1273,6 +1273,7 @@ int cache_mngt_add_core_to_cache(const char *cache_name, size_t name_len,
|
||||
}
|
||||
|
||||
cfg->seq_cutoff_threshold = seq_cut_off_mb * MiB;
|
||||
cfg->seq_cutoff_promotion_count = 8;
|
||||
|
||||
init_completion(&add_context.cmpl);
|
||||
add_context.core = &core;
|
||||
@ -2136,6 +2137,43 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief routine implementing dynamic sequential cutoff parameter switching
|
||||
* @param[in] cache cache to which the change pertains
|
||||
* @param[in] core core to which the change pertains
|
||||
* or NULL for setting value for all cores attached to specified cache
|
||||
* @param[in] count new sequential cutoff promotion request count value
|
||||
* @return exit code of successful completion is 0;
|
||||
* nonzero exit code means failure
|
||||
*/
|
||||
|
||||
int cache_mngt_set_seq_cutoff_promotion_count(ocf_cache_t cache,
|
||||
ocf_core_t core, uint32_t count)
|
||||
{
|
||||
int result;
|
||||
|
||||
result = _cache_mngt_lock_sync(cache);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
if (core) {
|
||||
result = ocf_mngt_core_set_seq_cutoff_promotion_count(core,
|
||||
count);
|
||||
} else {
|
||||
result = ocf_mngt_core_set_seq_cutoff_promotion_count_all(cache,
|
||||
count);
|
||||
}
|
||||
|
||||
if (result)
|
||||
goto out;
|
||||
|
||||
result = _cache_mngt_save_sync(cache);
|
||||
|
||||
out:
|
||||
ocf_mngt_cache_unlock(cache);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get sequential cutoff threshold value
|
||||
* @param[in] core OCF core
|
||||
@ -2183,6 +2221,30 @@ int cache_mngt_get_seq_cutoff_policy(ocf_core_t core,
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get sequential cutoff promotion request count value
|
||||
* @param[in] core OCF core
|
||||
* @param[out] count sequential cutoff promotion request count value
|
||||
* @return exit code of successful completion is 0;
|
||||
* nonzero exit code means failure
|
||||
*/
|
||||
|
||||
int cache_mngt_get_seq_cutoff_promotion_count(ocf_core_t core,
|
||||
uint32_t *count)
|
||||
{
|
||||
ocf_cache_t cache = ocf_core_get_cache(core);
|
||||
int result;
|
||||
|
||||
result = _cache_mngt_read_lock_sync(cache);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
result = ocf_mngt_core_get_seq_cutoff_promotion_count(core, count);
|
||||
|
||||
ocf_mngt_cache_read_unlock(cache);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int _cache_flush_with_lock(ocf_cache_t cache)
|
||||
{
|
||||
int result = 0;
|
||||
@ -2646,6 +2708,10 @@ int cache_mngt_set_core_params(struct kcas_set_core_param *info)
|
||||
result = cache_mngt_set_seq_cutoff_policy(cache, core,
|
||||
info->param_value);
|
||||
break;
|
||||
case core_param_seq_cutoff_promotion_count:
|
||||
result = cache_mngt_set_seq_cutoff_promotion_count(cache,
|
||||
core, info->param_value);
|
||||
break;
|
||||
default:
|
||||
result = -EINVAL;
|
||||
}
|
||||
@ -2678,6 +2744,10 @@ int cache_mngt_get_core_params(struct kcas_get_core_param *info)
|
||||
result = cache_mngt_get_seq_cutoff_policy(core,
|
||||
&info->param_value);
|
||||
break;
|
||||
case core_param_seq_cutoff_promotion_count:
|
||||
result = cache_mngt_get_seq_cutoff_promotion_count(core,
|
||||
&info->param_value);
|
||||
break;
|
||||
default:
|
||||
result = -EINVAL;
|
||||
}
|
||||
|
@ -330,6 +330,7 @@ struct kcas_cache_check_device {
|
||||
enum kcas_core_param_id {
|
||||
core_param_seq_cutoff_threshold,
|
||||
core_param_seq_cutoff_policy,
|
||||
core_param_seq_cutoff_promotion_count,
|
||||
core_param_id_max,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user