[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251230034516.48129-1-sj@kernel.org>
Date: Mon, 29 Dec 2025 19:45:14 -0800
From: SeongJae Park <sj@...nel.org>
To: SeongJae Park <sj@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"# 6 . 14 . x" <stable@...r.kernel.org>,
damon@...ts.linux.dev,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
JaeJoon Jung <rgbi3307@...il.com>
Subject: Re: [PATCH] mm/damon/core: remove call_control in inactive contexts
On Mon, 29 Dec 2025 18:41:28 -0800 SeongJae Park <sj@...nel.org> wrote:
> On Mon, 29 Dec 2025 17:45:30 -0800 SeongJae Park <sj@...nel.org> wrote:
>
> > On Sun, 28 Dec 2025 10:31:01 -0800 SeongJae Park <sj@...nel.org> wrote:
> >
[...]
> > I will send a new version of this fix soon.
>
> So far, I got two fixup ideas.
>
> The first one is keeping the current code as is, and additionally modifying
> kdamond_call() to protect all call_control object accesses under
> ctx->call_controls_lock protection.
>
> The second one is reverting this patch, and doing the DAMON running status
> check before adding the damon_call_control object, but releasing the
> kdamond_lock after the object insertion is done.
>
> I'm in favor of the second one at the moment, as it seems more simple.
I don't really like both approaches because those implicitly add locking rules.
If the first approach is taken, damon_call() callers should aware they should
not register callback functions that can hold call_controls_lock. If the
second approach is taken, we should avoid holding kdamond_lock while holding
damon_call_control lock. The second implicit rule seems easier to keep to me,
but I want to avoid that if possible.
The third idea I just got is, keeping this patch as is, and moving the final
kdamond_call() invocation to be made _before_ the ctx->kdamond reset. That
removes the race condition between the final kdamond_call() and
damon_call_handle_inactive_ctx(), without introducing new locking rules.
Thanks,
SJ
[...]
Powered by blists - more mailing lists