Re: [PATCH 1/1] mm/damon/sysfs: check DAMOS regions update progress from before_terminate()

From: SeongJae Park
Date: Sat Oct 07 2023 - 16:10:32 EST


Hello,

On Sat, 7 Oct 2023 20:04:32 +0000 SeongJae Park <sj@xxxxxxxxxx> wrote:

> DAMON_SYSFS can receive DAMOS tried regions update request while kdamond
> is already out of the main loop and before_terminate callback
> (damon_sysfs_before_terminate() in this case) is not yet called. And
> damon_sysfs_handle_cmd() can further be finished before the callback is
> invoked. Then, damon_sysfs_before_terminate() unlocks damon_sysfs_lock,
> which is not locked by anyone. This happens because the callback
> function assumes damon_sysfs_cmd_request_callback() should be called
> before it. Check if the assumption was true before doing the unlock, to
> avoid this problem.
>
> Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command")
> Cc: <stable@xxxxxxxxxxxxxxx> # 6.2.x

And this will not cleanly applied to 6.5.y, since this is based on latest
mm-unstable tree. I will send a backport once this is merged into the
mainline.


Thanks,
SJ

[...]