Skip to content

Commit 5257f36

Browse files
sjp38torvalds
authored andcommitted
mm/damon/core: add number of each enum type values
This commit declares the number of legal values for each DAMON enum types to make traversals of such DAMON enum types easy and safe. Link: https://lkml.kernel.org/r/20220228081314.5770-3-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Shuah Khan <skhan@linuxfoundation.org> Cc: Xin Hao <xhao@linux.alibaba.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8b9b0d3 commit 5257f36

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

include/linux/damon.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct damon_target {
8787
* @DAMOS_HUGEPAGE: Call ``madvise()`` for the region with MADV_HUGEPAGE.
8888
* @DAMOS_NOHUGEPAGE: Call ``madvise()`` for the region with MADV_NOHUGEPAGE.
8989
* @DAMOS_STAT: Do nothing but count the stat.
90+
* @NR_DAMOS_ACTIONS: Total number of DAMOS actions
9091
*/
9192
enum damos_action {
9293
DAMOS_WILLNEED,
@@ -95,6 +96,7 @@ enum damos_action {
9596
DAMOS_HUGEPAGE,
9697
DAMOS_NOHUGEPAGE,
9798
DAMOS_STAT, /* Do nothing but only record the stat */
99+
NR_DAMOS_ACTIONS,
98100
};
99101

100102
/**
@@ -157,10 +159,12 @@ struct damos_quota {
157159
*
158160
* @DAMOS_WMARK_NONE: Ignore the watermarks of the given scheme.
159161
* @DAMOS_WMARK_FREE_MEM_RATE: Free memory rate of the system in [0,1000].
162+
* @NR_DAMOS_WMARK_METRICS: Total number of DAMOS watermark metrics
160163
*/
161164
enum damos_wmark_metric {
162165
DAMOS_WMARK_NONE,
163166
DAMOS_WMARK_FREE_MEM_RATE,
167+
NR_DAMOS_WMARK_METRICS,
164168
};
165169

166170
/**

0 commit comments

Comments
 (0)