nhit PP: Added info about setting nhit params

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
Michal Rakowski 2019-09-25 09:42:15 +02:00
parent 07aa29fc56
commit 23aba6a9f3

View File

@ -68,12 +68,17 @@ ocf_error_t nhit_set_param(ocf_promotion_policy_t policy, uint8_t param_id,
{ {
struct nhit_policy_context *ctx = policy->ctx; struct nhit_policy_context *ctx = policy->ctx;
ocf_error_t result = 0; ocf_error_t result = 0;
uint64_t thr_clines;
uint32_t thr_percent;
switch (param_id) { switch (param_id) {
case ocf_nhit_insertion_threshold: case ocf_nhit_insertion_threshold:
if (param_value >= OCF_NHIT_MIN_THRESHOLD && if (param_value >= OCF_NHIT_MIN_THRESHOLD &&
param_value <= OCF_NHIT_MAX_THRESHOLD) { param_value <= OCF_NHIT_MAX_THRESHOLD) {
env_atomic_set(&ctx->insertion_threshold, param_value); env_atomic_set(&ctx->insertion_threshold, param_value);
ocf_cache_log(policy->owner, log_info,
"Nhit PP insertion threshold value set to %u",
param_value);
} else { } else {
ocf_cache_log(policy->owner, log_err, "Invalid nhit " ocf_cache_log(policy->owner, log_err, "Invalid nhit "
"promotion policy insertion threshold!\n"); "promotion policy insertion threshold!\n");
@ -84,11 +89,17 @@ ocf_error_t nhit_set_param(ocf_promotion_policy_t policy, uint8_t param_id,
case ocf_nhit_trigger_threshold: case ocf_nhit_trigger_threshold:
if (param_value >= OCF_NHIT_MIN_TRIGGER && if (param_value >= OCF_NHIT_MIN_TRIGGER &&
param_value <= OCF_NHIT_MAX_TRIGGER) { param_value <= OCF_NHIT_MAX_TRIGGER) {
env_atomic64_set(&ctx->trigger_threshold, thr_clines = OCF_DIV_ROUND_UP((param_value *
OCF_DIV_ROUND_UP((param_value *
ocf_metadata_get_cachelines_count(policy->owner)), ocf_metadata_get_cachelines_count(policy->owner)),
100)); 100);
env_atomic64_set(&ctx->trigger_threshold, thr_clines);
thr_percent = OCF_DIV_ROUND_UP(thr_clines * 100,
ocf_metadata_get_cachelines_count(policy->owner));
ocf_cache_log(policy->owner, log_info,
"Nhit PP trigger threshold value set to %u%% (%"
ENV_PRIu64 "occupied cachelines)",
thr_percent, thr_clines);
} else { } else {
ocf_cache_log(policy->owner, log_err, "Invalid nhit " ocf_cache_log(policy->owner, log_err, "Invalid nhit "
"promotion policy insertion trigger " "promotion policy insertion trigger "