• SeongJae Park's avatar
    mm/damon/core: implement scheme-specific apply interval · 42f994b7
    SeongJae Park authored
    DAMON-based operation schemes are applied for every aggregation interval. 
    That was mainly because schemes were using nr_accesses, which be complete
    to be used for every aggregation interval.  However, the schemes are now
    using nr_accesses_bp, which is updated for each sampling interval in a way
    that reasonable to be used.  Therefore, there is no reason to apply
    schemes for each aggregation interval.
    
    The unnecessary alignment with aggregation interval was also making some
    use cases of DAMOS tricky.  Quotas setting under long aggregation interval
    is one such example.  Suppose the aggregation interval is ten seconds, and
    there is a scheme having CPU quota 100ms per 1s.  The scheme will actually
    uses 100ms per ten seconds, since it cannobe be applied before next
    aggregation interval.  The feature is working as intended, but the results
    might not that intuitive for some users.  This could be fixed by updating
    the quota to 1s per 10s.  But, in the case, the CPU usage of DAMOS could
    look like spikes, and would actually make a bad effect to other
    CPU-sensitive workloads.
    
    Implement a dedicated timing interval for each DAMON-based operation
    scheme, namely apply_interval.  The interval will be sampling interval
    aligned, and each scheme will be applied for its apply_interval.  The
    interval is set to 0 by default, and it means the scheme should use the
    aggregation interval instead.  This avoids old users getting any
    behavioral difference.
    
    Link: https://lkml.kernel.org/r/20230916020945.47296-5-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    42f994b7
core.c 43.6 KB