xref: /openbmc/linux/mm/damon/modules-common.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1b3c28d88SSeongJae Park /* SPDX-License-Identifier: GPL-2.0 */
2b3c28d88SSeongJae Park /*
3b3c28d88SSeongJae Park  * Common Primitives for DAMON Modules
4b3c28d88SSeongJae Park  *
5b3c28d88SSeongJae Park  * Author: SeongJae Park <sj@kernel.org>
6b3c28d88SSeongJae Park  */
7b3c28d88SSeongJae Park 
8b3c28d88SSeongJae Park #include <linux/moduleparam.h>
9b3c28d88SSeongJae Park 
10b3c28d88SSeongJae Park #define DEFINE_DAMON_MODULES_MON_ATTRS_PARAMS(attrs)			\
11b3c28d88SSeongJae Park 	module_param_named(sample_interval, attrs.sample_interval,	\
12b3c28d88SSeongJae Park 			ulong, 0600);					\
13b3c28d88SSeongJae Park 	module_param_named(aggr_interval, attrs.aggr_interval, ulong,	\
14b3c28d88SSeongJae Park 			0600);						\
15b3c28d88SSeongJae Park 	module_param_named(min_nr_regions, attrs.min_nr_regions, ulong,	\
16b3c28d88SSeongJae Park 			0600);						\
17b3c28d88SSeongJae Park 	module_param_named(max_nr_regions, attrs.max_nr_regions, ulong,	\
18b3c28d88SSeongJae Park 			0600);
19b324ee36SSeongJae Park 
201f554026SSeongJae Park #define DEFINE_DAMON_MODULES_DAMOS_TIME_QUOTA(quota)			\
2163e0f90bSSeongJae Park 	module_param_named(quota_ms, quota.ms, ulong, 0600);		\
2263e0f90bSSeongJae Park 	module_param_named(quota_reset_interval_ms,			\
2363e0f90bSSeongJae Park 			quota.reset_interval, ulong, 0600);
2463e0f90bSSeongJae Park 
251f554026SSeongJae Park #define DEFINE_DAMON_MODULES_DAMOS_QUOTAS(quota)			\
261f554026SSeongJae Park 	DEFINE_DAMON_MODULES_DAMOS_TIME_QUOTA(quota)			\
271f554026SSeongJae Park 	module_param_named(quota_sz, quota.sz, ulong, 0600);
281f554026SSeongJae Park 
29b324ee36SSeongJae Park #define DEFINE_DAMON_MODULES_WMARKS_PARAMS(wmarks)			\
306517d2d9SSeongJae Park 	module_param_named(wmarks_interval, wmarks.interval, ulong,	\
31b324ee36SSeongJae Park 			0600);						\
32b324ee36SSeongJae Park 	module_param_named(wmarks_high, wmarks.high, ulong, 0600);	\
33b324ee36SSeongJae Park 	module_param_named(wmarks_mid, wmarks.mid, ulong, 0600);	\
346517d2d9SSeongJae Park 	module_param_named(wmarks_low, wmarks.low, ulong, 0600);
35528ef2d9SSeongJae Park 
36528ef2d9SSeongJae Park #define DEFINE_DAMON_MODULES_DAMOS_STATS_PARAMS(stat, try_name,		\
37528ef2d9SSeongJae Park 		succ_name, qt_exceed_name)				\
38528ef2d9SSeongJae Park 	module_param_named(nr_##try_name, stat.nr_tried, ulong, 0400);	\
39528ef2d9SSeongJae Park 	module_param_named(bytes_##try_name, stat.sz_tried, ulong,	\
40528ef2d9SSeongJae Park 			0400);						\
41528ef2d9SSeongJae Park 	module_param_named(nr_##succ_name, stat.nr_applied, ulong,	\
42528ef2d9SSeongJae Park 			0400);						\
43528ef2d9SSeongJae Park 	module_param_named(bytes_##succ_name, stat.sz_applied, ulong,	\
44528ef2d9SSeongJae Park 			0400);						\
4563e0f90bSSeongJae Park 	module_param_named(nr_##qt_exceed_name, stat.qt_exceeds, ulong,	\
46528ef2d9SSeongJae Park 			0400);
47*7ae2c17fSSeongJae Park 
48*7ae2c17fSSeongJae Park int damon_modules_new_paddr_ctx_target(struct damon_ctx **ctxp,
49*7ae2c17fSSeongJae Park 		struct damon_target **targetp);
50