Merge tag 'wq-for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[linux-block.git] / include / linux / damon.h
index d5d4d19928e0ac97df6a4ccf5c0c38c3d7358b71..ae2664d1d5f1def314d104e71364f518884417f0 100644 (file)
@@ -226,16 +226,26 @@ struct damos_stat {
  * enum damos_filter_type - Type of memory for &struct damos_filter
  * @DAMOS_FILTER_TYPE_ANON:    Anonymous pages.
  * @DAMOS_FILTER_TYPE_MEMCG:   Specific memcg's pages.
+ * @DAMOS_FILTER_TYPE_ADDR:    Address range.
+ * @DAMOS_FILTER_TYPE_TARGET:  Data Access Monitoring target.
  * @NR_DAMOS_FILTER_TYPES:     Number of filter types.
  *
- * The support of each filter type is up to running &struct damon_operations.
- * &enum DAMON_OPS_PADDR is supporting all filter types, while
- * &enum DAMON_OPS_VADDR and &enum DAMON_OPS_FVADDR are not supporting any
- * filter types.
+ * The anon pages type and memcg type filters are handled by underlying
+ * &struct damon_operations as a part of scheme action trying, and therefore
+ * accounted as 'tried'.  In contrast, other types are handled by core layer
+ * before trying of the action and therefore not accounted as 'tried'.
+ *
+ * The support of the filters that handled by &struct damon_operations depend
+ * on the running &struct damon_operations.
+ * &enum DAMON_OPS_PADDR supports both anon pages type and memcg type filters,
+ * while &enum DAMON_OPS_VADDR and &enum DAMON_OPS_FVADDR don't support any of
+ * the two types.
  */
 enum damos_filter_type {
        DAMOS_FILTER_TYPE_ANON,
        DAMOS_FILTER_TYPE_MEMCG,
+       DAMOS_FILTER_TYPE_ADDR,
+       DAMOS_FILTER_TYPE_TARGET,
        NR_DAMOS_FILTER_TYPES,
 };
 
@@ -244,18 +254,24 @@ enum damos_filter_type {
  * @type:      Type of the page.
  * @matching:  If the matching page should filtered out or in.
  * @memcg_id:  Memcg id of the question if @type is DAMOS_FILTER_MEMCG.
+ * @addr_range:        Address range if @type is DAMOS_FILTER_TYPE_ADDR.
+ * @target_idx:        Index of the &struct damon_target of
+ *             &damon_ctx->adaptive_targets if @type is
+ *             DAMOS_FILTER_TYPE_TARGET.
  * @list:      List head for siblings.
  *
  * Before applying the &damos->action to a memory region, DAMOS checks if each
  * page of the region matches to this and avoid applying the action if so.
- * Note that the check support is up to &struct damon_operations
- * implementation.
+ * Support of each filter type depends on the running &struct damon_operations
+ * and the type.  Refer to &enum damos_filter_type for more detai.
  */
 struct damos_filter {
        enum damos_filter_type type;
        bool matching;
        union {
                unsigned short memcg_id;
+               struct damon_addr_range addr_range;
+               int target_idx;
        };
        struct list_head list;
 };