• SeongJae Park's avatar
    mm/damon/sysfs: support DAMON-based Operation Schemes · 7e84b1f8
    SeongJae Park authored
    This commit makes DAMON sysfs interface supports the DAMON-based operation
    schemes (DAMOS) feature.  Specifically, this commit adds 'schemes'
    directory under each context direcotry, and makes kdamond 'state' file
    writing respects the contents in the directory.
    
    Note that this commit doesn't support all features of DAMOS but only the
    target access pattern and action feature.  Supports for quotas,
    prioritization, watermarks will follow.
    
    As a result, the files hierarchy becomes as below:
    
        /sys/kernel/mm/damon/admin
        │ kdamonds/nr_kdamonds
        │ │ 0/state,pid
        │ │ │ contexts/nr_contexts
        │ │ │ │ 0/operations
        │ │ │ │ │ monitoring_attrs/intervals/sample_us,aggr_us,update_us
        │ │ │ │ │ │ nr_regions/min,max
        │ │ │ │ │ targets/nr_targets
        │ │ │ │ │ │ 0/pid_target
        │ │ │ │ │ │ │ regions/nr_regions
        │ │ │ │ │ │ │ │ 0/start,end
        │ │ │ │ │ │ │ │ ...
        │ │ │ │ │ │ ...
        │ │ │ │ │ schemes/nr_schemes    <- NEW DIRECTORY
        │ │ │ │ │ │ 0/action
        │ │ │ │ │ │ │ access_pattern/
        │ │ │ │ │ │ │ │ sz/min,max
        │ │ │ │ │ │ │ │ nr_accesses/min,max
        │ │ │ │ │ │ │ │ age/min,max
        │ │ │ │ │ │ ...
        │ │ │ │ ...
        │ │ ...
    
    Link: https://lkml.kernel.org/r/20220228081314.5770-7-sj@kernel.orgSigned-off-by: default avatarSeongJae 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7e84b1f8
sysfs.c 44.8 KB