Re: [PATCH 1/2] mm/damon/sysfs: Implement recording feature

From: SeongJae Park
Date: Wed Nov 29 2023 - 12:11:05 EST


Hi Cuiyangpei,

On Wed, 29 Nov 2023 21:13:15 +0800 cuiyangpei <cuiyangpei@xxxxxxxxx> wrote:

> Hi SeongJae,
>
> We are using damon on the Android operating system. It starts monitoring
> when app comes to the foreground, stops monitoring and save the
> monitoring results when app goes to the background.

Thank you so much for sharing this detailed use case. This will be very
helpful for us at understanding real usage of DAMON and making it better for
that together.

>
> The two methods that you mentioned,
>
> 1.tracepoint events
> This method requires opening the tracepoint event and using the
> 'perf-record' tool to generate the perf.data file. Then parsing the
> perf.data file. However, the user's phone is not enabled tracepoint
> events. Additionally, the generated file is quite complex, and we only
> need memory addresses and access frequency informations.

That's fair points, thank you for kindly explaining this.

>
> 2. damos
> There is no direct Python runtime environment on android phones.
>
> Both of these methods provide results that are not very intuitive and
> require complex parsing. We save the results in the format of starting
> address, region size, and access frequency. When the available memory
> reaches a threshold, the user space reclaim memory with low access
> frequency by calling 'process_madvise' function.

Again, very fair points. So, if I understood correctly, you want to reclaim
cold pages proactively when the available memory reaches a threshold, right?
DAMON could do that directly instead of you[1]. Using that, you don't need to
save the access pattern and parse but just ask DAMON to find memory regions of
specific access frequency range and reclaim. Have you also considered using
that but found some problems?

I understand the feature may not perfectly fit for your use case, and I want to
learn from you how it could be better.

[1] https://docs.kernel.org/mm/damon/design.html#operation-schemes


Thanks,
SJ

>
> Thanks.
>
[...]