-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
casadm: add
max_dirty_ratio' for
alru'
Signed-off-by: Qun Li <[email protected]>
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright(c) 2012-2022 Intel Corporation | ||
* Copyright(c) 2022 David Lee <[email protected]> | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
|
@@ -703,6 +704,9 @@ static struct cas_param cas_cache_params[] = { | |
[cache_param_cleaning_alru_activity_threshold] = { | ||
.name = "Activity threshold [ms]" , | ||
}, | ||
[cache_param_cleaning_alru_max_dirty_ratio] = { | ||
.name = "Maximum dirty ratio [percent]", | ||
}, | ||
|
||
/* Cleaning policy ACP params */ | ||
[cache_param_cleaning_acp_wake_up_time] = { | ||
|
@@ -747,6 +751,8 @@ static struct cas_param cas_cache_params[] = { | |
" <%d-%d> (default: %d)" | ||
#define CLEANING_ALRU_ACTIVITY_THRESHOLD_DESC "Cache idle time before flushing thread can start <%d-%d>[ms]" \ | ||
" (default: %d ms)" | ||
#define CLEANING_ALRU_MAX_DIRTY_RATIO_DESC "Maximum dirty ratio of the cache device" \ | ||
" <%d-%d> (default: %d)" | ||
|
||
#define CLEANING_ACP_WAKE_UP_DESC "Time between ACP cleaning thread iterations <%d-%d>[ms] (default: %d ms)" | ||
#define CLEANING_ACP_MAX_BUFFERS_DESC "Number of cache lines flushed in single ACP cleaning thread iteration" \ | ||
|
@@ -807,6 +813,10 @@ static cli_namespace set_param_namespace = { | |
CLI_OPTION_RANGE_INT | CLI_OPTION_DEFAULT_INT, | ||
OCF_ALRU_MIN_ACTIVITY_THRESHOLD, OCF_ALRU_MAX_ACTIVITY_THRESHOLD, | ||
OCF_ALRU_DEFAULT_ACTIVITY_THRESHOLD}, | ||
{'d', "max-dirty-ratio", CLEANING_ALRU_MAX_DIRTY_RATIO_DESC, 1, "NUMBER", | ||
CLI_OPTION_RANGE_INT | CLI_OPTION_DEFAULT_INT, | ||
OCF_ALRU_MIN_MAX_DIRTY_RATIO, OCF_ALRU_MAX_MAX_DIRTY_RATIO, | ||
OCF_ALRU_DEFAULT_MAX_DIRTY_RATIO}, | ||
CACHE_PARAMS_NS_END() | ||
|
||
CACHE_PARAMS_NS_BEGIN("cleaning-acp", "Cleaning policy ACP parameters") | ||
|
@@ -918,6 +928,14 @@ int set_param_cleaning_alru_handle_option(char *opt, const char **arg) | |
|
||
SET_CACHE_PARAM(cache_param_cleaning_alru_activity_threshold, | ||
strtoul(arg[0], NULL, 10)); | ||
} else if (!strcmp(opt, "max-dirty-ratio")) { | ||
if (validate_str_num(arg[0], "max dirty ratio", | ||
OCF_ALRU_MIN_MAX_DIRTY_RATIO, OCF_ALRU_MAX_MAX_DIRTY_RATIO)) { | ||
return FAILURE; | ||
} | ||
|
||
SET_CACHE_PARAM(cache_param_cleaning_alru_max_dirty_ratio, | ||
strtoul(arg[0], NULL, 10)); | ||
} else { | ||
return FAILURE; | ||
} | ||
|
@@ -1098,6 +1116,7 @@ int get_param_namespace_handle_option(char *namespace, char *opt, const char **a | |
SELECT_CACHE_PARAM(cache_param_cleaning_alru_stale_buffer_time); | ||
SELECT_CACHE_PARAM(cache_param_cleaning_alru_flush_max_buffers); | ||
SELECT_CACHE_PARAM(cache_param_cleaning_alru_activity_threshold); | ||
SELECT_CACHE_PARAM(cache_param_cleaning_alru_max_dirty_ratio); | ||
return cache_param_handle_option_generic(opt, arg, | ||
get_param_handle_option); | ||
} else if (!strcmp(namespace, "cleaning-acp")) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright(c) 2012-2022 Intel Corporation | ||
* Copyright(c) 2022 David Lee <[email protected]> | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
|
@@ -3326,6 +3327,11 @@ int cache_mngt_set_cache_params(struct kcas_set_cache_param *info) | |
ocf_cleaning_alru, ocf_alru_activity_threshold, | ||
info->param_value); | ||
break; | ||
case cache_param_cleaning_alru_max_dirty_ratio: | ||
result = cache_mngt_set_cleaning_param(cache, | ||
ocf_cleaning_alru, ocf_alru_max_dirty_ratio, | ||
info->param_value); | ||
break; | ||
|
||
case cache_param_cleaning_acp_wake_up_time: | ||
result = cache_mngt_set_cleaning_param(cache, | ||
|
@@ -3390,6 +3396,11 @@ int cache_mngt_get_cache_params(struct kcas_get_cache_param *info) | |
ocf_cleaning_alru, ocf_alru_activity_threshold, | ||
&info->param_value); | ||
break; | ||
case cache_param_cleaning_alru_max_dirty_ratio: | ||
result = cache_mngt_get_cleaning_param(cache, | ||
ocf_cleaning_alru, ocf_alru_max_dirty_ratio, | ||
&info->param_value); | ||
break; | ||
|
||
case cache_param_cleaning_acp_wake_up_time: | ||
result = cache_mngt_get_cleaning_param(cache, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright(c) 2012-2022 Intel Corporation | ||
* Copyright(c) 2022 David Lee <[email protected]> | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
|
@@ -331,6 +332,7 @@ enum kcas_cache_param_id { | |
cache_param_cleaning_alru_stale_buffer_time, | ||
cache_param_cleaning_alru_flush_max_buffers, | ||
cache_param_cleaning_alru_activity_threshold, | ||
cache_param_cleaning_alru_max_dirty_ratio, | ||
cache_param_cleaning_acp_wake_up_time, | ||
cache_param_cleaning_acp_flush_max_buffers, | ||
cache_param_promotion_policy_type, | ||
|