Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Yuho Choi <dbgh9129@gmail.com>
Cc: SeongJae Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm/damon/stat: roll back context on damon_call() failure
Date: Fri, 29 May 2026 07:44:35 -0700	[thread overview]
Message-ID: <20260529144435.83930-1-sj@kernel.org> (raw)
In-Reply-To: <20260529031519.1617000-1-dbgh9129@gmail.com>

Hello Yuho,


Thank you for sharing this patch!

On Thu, 28 May 2026 23:15:19 -0400 Yuho Choi <dbgh9129@gmail.com> wrote:

> damon_stat_start() allocates and starts damon_stat_context before
> registering the repeated damon_call() callback.  If damon_call() fails,
> the function currently returns the error while leaving the context
> allocated and stored in the global pointer.
> 
> The retry-time cleanup added for this path only runs if users try to
> enable DAMON_STAT again.  If no retry happens, the failed start leaves
> the context allocated indefinitely.
> 
> Roll back the failed start by stopping the kdamond before destroying
> the context and clearing the global pointer.  damon_stop() waits for a
> live kdamond via kthread_stop_put(); if the worker has already completed
> teardown, there is no kdamond left to wait on and the context can be
> destroyed.

But, having one damon_ctx object in the memory is a real problem?  Why?


Thanks,
SJ

[...]


  reply	other threads:[~2026-05-29 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  3:15 [PATCH v1] mm/damon/stat: roll back context on damon_call() failure Yuho Choi
2026-05-29 14:44 ` SeongJae Park [this message]
2026-05-29 15:17   ` 최유호
2026-05-29 16:00     ` SeongJae Park
2026-05-29 20:29       ` 최유호
2026-05-29 23:40         ` SeongJae Park

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=20260529144435.83930-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=dbgh9129@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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