• SeongJae Park's avatar
    mm/damon/sysfs: support DAMOS stats · 0ac32b8a
    SeongJae Park authored
    This commit makes DAMON sysfs interface supports the DAMOS stats feature.
    Specifically, this commit adds 'stats' directory under each scheme
    directory, and update the contents of the files under the directory
    according to the latest monitoring results, when the user writes special
    keyword, 'update_schemes_stats' to the 'state' file of the kdamond.
    
    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
        │ │ │ │ │ │ 0/action
        │ │ │ │ │ │ │ access_pattern/
        │ │ │ │ │ │ │ │ sz/min,max
        │ │ │ │ │ │ │ │ nr_accesses/min,max
        │ │ │ │ │ │ │ │ age/min,max
        │ │ │ │ │ │ │ quotas/ms,sz,reset_interval_ms
        │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil
        │ │ │ │ │ │ │ watermarks/metric,interval_us,high,mid,low
        │ │ │ │ │ │ │ stats/    <- NEW DIRECTORY
        │ │ │ │ │ │ │ │ nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds
        │ │ │ │ │ │ ...
        │ │ │ │ ...
        │ │ ...
    
    Link: https://lkml.kernel.org/r/20220228081314.5770-11-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>
    0ac32b8a
sysfs.c 61.9 KB