Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Karl Mehltretter <kmehltretter@gmail.com>
To: SJ Park <sj@kernel.org>
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] mm/damon: preserve quota state when constructing schemes
Date: Mon, 21 Sep 2026 02:30:45 +0200	[thread overview]
Message-ID: <20260921003047.12041-1-kmehltretter@gmail.com> (raw)

damon_new_scheme() initializes the caller's quota in place before copying
it. When damon_commit_ctx() clones the running context for validation,
the quota pointer belongs to a running scheme. Constructing the temporary
scheme therefore clears the running scheme's quota state, even if the
proposed update is later rejected with -EINVAL.

Initialize the new scheme's copy instead, and add KUnit tests for the
constructor and for accepted and rejected context updates.

In a live test with damo, a scheme with a plain 64 KiB size quota and a
60-second reset interval uses its quota, and a full "damo tune" with
unchanged parameters then lets it try another 64 KiB within the same
window. With the fix, sz_tried stays at 64 KiB.

With only patch 2 applied, the two new tests fail on x86-64 and i386.
With the fix, all 43 DAMON KUnit tests pass on both, and the DAMON
selftests show no new failures (QEMU TCG guest; the wss_estimation test
misses its accuracy bounds with and without the fix).

Karl Mehltretter (2):
  mm/damon/core: preserve the caller's quota in damon_new_scheme()
  mm/damon/tests/core-kunit: test preservation of caller quota state

 mm/damon/core.c             |   6 +-
 mm/damon/tests/core-kunit.h | 107 ++++++++++++++++++++++++++++++++++++
 2 files changed, 110 insertions(+), 3 deletions(-)


base-commit: 185111f116aabf202d12ce440c0f6e9bae073514
-- 
2.53.0



             reply	other threads:[~2026-09-21  0:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  0:30 Karl Mehltretter [this message]
2026-09-21  0:30 ` [PATCH 1/2] mm/damon/core: preserve the caller's quota in damon_new_scheme() Karl Mehltretter
2026-09-21 17:11   ` SJ Park
2026-09-22 12:08     ` SJ Park
2026-09-23 21:46       ` Karl Mehltretter
2026-09-24  7:33         ` SJ Park
2026-09-21  0:30 ` [PATCH 2/2] mm/damon/tests/core-kunit: test preservation of caller quota state Karl Mehltretter
2026-09-22 12:28   ` SJ 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=20260921003047.12041-1-kmehltretter@gmail.com \
    --to=kmehltretter@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sj@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