From: SeongJae Park <sj@kernel.org>
To: SeongJae Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"# 6 . 14 . x" <stable@vger.kernel.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, JaeJoon Jung <rgbi3307@gmail.com>
Subject: Re: [PATCH] mm/damon/core: remove call_control in inactive contexts
Date: Tue, 30 Dec 2025 17:25:20 -0800 [thread overview]
Message-ID: <20251231012522.75876-1-sj@kernel.org> (raw)
In-Reply-To: <20251230034516.48129-1-sj@kernel.org>
On Mon, 29 Dec 2025 19:45:14 -0800 SeongJae Park <sj@kernel.org> wrote:
> On Mon, 29 Dec 2025 18:41:28 -0800 SeongJae Park <sj@kernel.org> wrote:
>
> > On Mon, 29 Dec 2025 17:45:30 -0800 SeongJae Park <sj@kernel.org> wrote:
> >
> > > On Sun, 28 Dec 2025 10:31:01 -0800 SeongJae Park <sj@kernel.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.
I just posted the v2 [1] with the third idea.
[1] https://lore.kernel.org/20251231012315.75835-1-sj@kernel.org
Thanks,
SJ
[...]
next prev parent reply other threads:[~2025-12-31 1:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-28 18:31 SeongJae Park
2025-12-30 1:45 ` SeongJae Park
2025-12-30 2:41 ` SeongJae Park
2025-12-30 3:45 ` SeongJae Park
2025-12-31 1:25 ` SeongJae Park [this message]
2025-12-31 5:27 ` JaeJoon Jung
2025-12-31 15:26 ` SeongJae Park
2026-01-01 0:55 ` JaeJoon Jung
2026-01-01 1:41 ` SeongJae Park
2026-01-01 2:58 ` JaeJoon Jung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251231012522.75876-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rgbi3307@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox