mm/damon: move comments and fields for damos-quota-prioritization to the end
authorSeongJae Park <sj@kernel.org>
Mon, 19 Feb 2024 19:44:17 +0000 (11:44 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 24 Feb 2024 01:48:27 +0000 (17:48 -0800)
The comments and definition of 'struct damos_quota' lists a few fields for
effective quota generation first, fields for regions prioritization under
the quota, and then remaining fields for effective quota generation.
Readers' should unnecesssarily switch their context in the middle.  List
all the fields for the effective quota first, and then fields for the
prioritization for making it easier to read.

Link: https://lkml.kernel.org/r/20240219194431.159606-7-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/damon.h

index 93ef45b..bd17b14 100644 (file)
@@ -128,18 +128,17 @@ enum damos_action {
 
 /**
  * struct damos_quota - Controls the aggressiveness of the given scheme.
+ * @reset_interval:    Charge reset interval in milliseconds.
  * @ms:                        Maximum milliseconds that the scheme can use.
  * @sz:                        Maximum bytes of memory that the action can be applied.
- * @reset_interval:    Charge reset interval in milliseconds.
+ * @get_score:         Feedback function for self-tuning quota.
+ * @get_score_arg:     Parameter for @get_score
+ * @esz:               Effective size quota in bytes.
  *
  * @weight_sz:         Weight of the region's size for prioritization.
  * @weight_nr_accesses:        Weight of the region's nr_accesses for prioritization.
  * @weight_age:                Weight of the region's age for prioritization.
  *
- * @get_score:         Feedback function for self-tuning quota.
- * @get_score_arg:     Parameter for @get_score
- * @esz:               Effective size quota in bytes.
- *
  * To avoid consuming too much CPU time or IO resources for applying the
  * &struct damos->action to large memory, DAMON allows users to set time and/or
  * size quotas.  The quotas can be set by writing non-zero values to &ms and
@@ -152,12 +151,6 @@ enum damos_action {
  * throughput of the scheme's action.  DAMON then compares it against &sz and
  * uses smaller one as the effective quota.
  *
- * For selecting regions within the quota, DAMON prioritizes current scheme's
- * target memory regions using the &struct damon_operations->get_scheme_score.
- * You could customize the prioritization logic by setting &weight_sz,
- * &weight_nr_accesses, and &weight_age, because monitoring operations are
- * encouraged to respect those.
- *
  * If @get_score function pointer is set, DAMON calls it back with
  * @get_score_arg and get the return value of it for every @reset_interval.
  * Then, DAMON adjusts the effective quota using the return value as a feedback
@@ -170,20 +163,25 @@ enum damos_action {
  * set, the mechanism starts from the quota of one byte.
  *
  * The resulting effective size quota in bytes is set to @esz.
+ *
+ * For selecting regions within the quota, DAMON prioritizes current scheme's
+ * target memory regions using the &struct damon_operations->get_scheme_score.
+ * You could customize the prioritization logic by setting &weight_sz,
+ * &weight_nr_accesses, and &weight_age, because monitoring operations are
+ * encouraged to respect those.
  */
 struct damos_quota {
+       unsigned long reset_interval;
        unsigned long ms;
        unsigned long sz;
-       unsigned long reset_interval;
+       unsigned long (*get_score)(void *arg);
+       void *get_score_arg;
+       unsigned long esz;
 
        unsigned int weight_sz;
        unsigned int weight_nr_accesses;
        unsigned int weight_age;
 
-       unsigned long (*get_score)(void *arg);
-       void *get_score_arg;
-       unsigned long esz;
-
 /* private: */
        /* For throughput estimation */
        unsigned long total_charged_sz;