@@ -89,6 +89,26 @@ enum damos_action {
8989 DAMOS_STAT , /* Do nothing but only record the stat */
9090};
9191
92+ /**
93+ * struct damos_quota - Controls the aggressiveness of the given scheme.
94+ * @sz: Maximum bytes of memory that the action can be applied.
95+ * @reset_interval: Charge reset interval in milliseconds.
96+ *
97+ * To avoid consuming too much CPU time or IO resources for applying the
98+ * &struct damos->action to large memory, DAMON allows users to set a size
99+ * quota. The quota can be set by writing non-zero values to &sz. If the size
100+ * quota is set, DAMON tries to apply the action only up to &sz bytes within
101+ * &reset_interval.
102+ */
103+ struct damos_quota {
104+ unsigned long sz ;
105+ unsigned long reset_interval ;
106+
107+ /* private: For charging the quota */
108+ unsigned long charged_sz ;
109+ unsigned long charged_from ;
110+ };
111+
92112/**
93113 * struct damos - Represents a Data Access Monitoring-based Operation Scheme.
94114 * @min_sz_region: Minimum size of target regions.
@@ -98,13 +118,20 @@ enum damos_action {
98118 * @min_age_region: Minimum age of target regions.
99119 * @max_age_region: Maximum age of target regions.
100120 * @action: &damo_action to be applied to the target regions.
121+ * @quota: Control the aggressiveness of this scheme.
101122 * @stat_count: Total number of regions that this scheme is applied.
102123 * @stat_sz: Total size of regions that this scheme is applied.
103124 * @list: List head for siblings.
104125 *
105- * For each aggregation interval, DAMON applies @action to monitoring target
106- * regions fit in the condition and updates the statistics. Note that both
107- * the minimums and the maximums are inclusive.
126+ * For each aggregation interval, DAMON finds regions which fit in the
127+ * condition (&min_sz_region, &max_sz_region, &min_nr_accesses,
128+ * &max_nr_accesses, &min_age_region, &max_age_region) and applies &action to
129+ * those. To avoid consuming too much CPU time or IO resources for the
130+ * &action, "a is used.
131+ *
132+ * After applying the &action to each region, &stat_count and &stat_sz is
133+ * updated to reflect the number of regions and total size of regions that the
134+ * &action is applied.
108135 */
109136struct damos {
110137 unsigned long min_sz_region ;
@@ -114,6 +141,7 @@ struct damos {
114141 unsigned int min_age_region ;
115142 unsigned int max_age_region ;
116143 enum damos_action action ;
144+ struct damos_quota quota ;
117145 unsigned long stat_count ;
118146 unsigned long stat_sz ;
119147 struct list_head list ;
@@ -310,7 +338,7 @@ struct damos *damon_new_scheme(
310338 unsigned long min_sz_region , unsigned long max_sz_region ,
311339 unsigned int min_nr_accesses , unsigned int max_nr_accesses ,
312340 unsigned int min_age_region , unsigned int max_age_region ,
313- enum damos_action action );
341+ enum damos_action action , struct damos_quota * quota );
314342void damon_add_scheme (struct damon_ctx * ctx , struct damos * s );
315343void damon_destroy_scheme (struct damos * s );
316344
0 commit comments