Re: [PATCH 1/2] mm/damon/sysfs: remove requested targets when online-commit inputs

From: SeongJae Park
Date: Sat Oct 28 2023 - 17:09:39 EST


On Sun, 22 Oct 2023 21:07:33 +0000 SeongJae Park <sj@xxxxxxxxxx> wrote:

> damon_sysfs_set_targets(), which updates the targets of the context for
> online commitment, do not remove targets that removed from the
> corresponding sysfs files. As a result, more than intended targets of
> the context can exist and hence consume memory and monitoring CPU
> resource more than expected.
>
> Fix it by removing all targets of the context and fill up again using
> the user input. This could cause unnecessary memory dealloc and realloc
> operations, but this is not a hot code path. Also, note that
> damon_target is stateless, and hence no data is lost.

This is not true. 'struct damon_target' contains monitoring results
(regions_list). Hence, this patch makes all monitoring results to be removed
whenever doing online-commit. I was confused with init_regions at the time of
this writing, sorry.

I will send a fix for this soon.


Thanks,
SJ