xref: /openbmc/linux/mm/damon/modules-common.h (revision 3bf90eca)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Common Primitives for DAMON Modules
4  *
5  * Author: SeongJae Park <sj@kernel.org>
6  */
7 
8 #include <linux/moduleparam.h>
9 
10 #define DEFINE_DAMON_MODULES_MON_ATTRS_PARAMS(attrs)			\
11 	module_param_named(sample_interval, attrs.sample_interval,	\
12 			ulong, 0600);					\
13 	module_param_named(aggr_interval, attrs.aggr_interval, ulong,	\
14 			0600);						\
15 	module_param_named(min_nr_regions, attrs.min_nr_regions, ulong,	\
16 			0600);						\
17 	module_param_named(max_nr_regions, attrs.max_nr_regions, ulong,	\
18 			0600);
19 
20 #define DEFINE_DAMON_MODULES_DAMOS_TIME_QUOTA(quota)			\
21 	module_param_named(quota_ms, quota.ms, ulong, 0600);		\
22 	module_param_named(quota_reset_interval_ms,			\
23 			quota.reset_interval, ulong, 0600);
24 
25 #define DEFINE_DAMON_MODULES_DAMOS_QUOTAS(quota)			\
26 	DEFINE_DAMON_MODULES_DAMOS_TIME_QUOTA(quota)			\
27 	module_param_named(quota_sz, quota.sz, ulong, 0600);
28 
29 #define DEFINE_DAMON_MODULES_WMARKS_PARAMS(wmarks)			\
30 	module_param_named(wmarks_interval, wmarks.interval, ulong,	\
31 			0600);						\
32 	module_param_named(wmarks_high, wmarks.high, ulong, 0600);	\
33 	module_param_named(wmarks_mid, wmarks.mid, ulong, 0600);	\
34 	module_param_named(wmarks_low, wmarks.low, ulong, 0600);
35 
36 #define DEFINE_DAMON_MODULES_DAMOS_STATS_PARAMS(stat, try_name,		\
37 		succ_name, qt_exceed_name)				\
38 	module_param_named(nr_##try_name, stat.nr_tried, ulong, 0400);	\
39 	module_param_named(bytes_##try_name, stat.sz_tried, ulong,	\
40 			0400);						\
41 	module_param_named(nr_##succ_name, stat.nr_applied, ulong,	\
42 			0400);						\
43 	module_param_named(bytes_##succ_name, stat.sz_applied, ulong,	\
44 			0400);						\
45 	module_param_named(nr_##qt_exceed_name, stat.qt_exceeds, ulong,	\
46 			0400);
47 
48 int damon_modules_new_paddr_ctx_target(struct damon_ctx **ctxp,
49 		struct damon_target **targetp);
50