Re: [PATCH v16 03/14] mm/damon: Implement region based sampling

From: Leonard Foerster
Date: Thu Jun 18 2020 - 05:23:24 EST


On 2020-06-15T18:19:16+02:00 SeongJae Park <sjpark@xxxxxxxxxx> wrote:

> From: SeongJae Park <sjpark@xxxxxxxxx>
>
> This commit implements DAMON's target address space independent high
> level logics for basic access check and region based sampling. The
> target address space specific logics for the monitoring target address
> regions construction and the access check are required, though. The
> following commits will provide reference implementations of those for
> the general virtual address spaces and the physical address space.
> Users can implement and use their own versions for their specific use
> cases, though.
>
> Basic Access Check
> ------------------
>
> DAMON basically reports what pages are how frequently accessed. The
> frequency is not an absolute number of accesses, but a ratio.
>
> For this, DAMON first calls target monitoring construction callback
> (``init_target_regions``), and then the access check callbacks, which is
> assumed to check the access to each page and aggregates the number of
> observed accesses of each page, for every ``sampling interval``.
> Finally, DAMON resets the aggregated count per ``aggregation interval``.
>
> This is thus similar to the common periodic access checks based
> monitoring mechanisms but provides the access frequency. The overhead
> will increase as the size of the target process grows.
>
> Region Based Sampling
> ---------------------
>
> To avoid the unbounded increase of the overhead, DAMON groups a number
> of adjacent pages that assumed to have same access frequencies into a
> region. As long as the assumption (pages in a region have same access
> frequencies) is kept, only one page in the region is required to be
> checked. Therefore, the monitoring overhead is controllable by setting
> the number of regions.
>
> Nonetheless, this scheme cannot preserve the quality of the output if
> the assumption is not kept. Following commit will introduce how we can
> make the guarantee with some sort of best effort.
>
> Signed-off-by: SeongJae Park <sjpark@xxxxxxxxx>
> ---

Reviewed-by: Leonard Foerster <foersleo@xxxxxxxxx>