damon.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH 1/3] mm/damon/core: error damos_commit_quota_goal() for zero target_value
Date: Thu, 13 Aug 2026 05:57:33 +0000	[thread overview]
Message-ID: <20260813055733.E453E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813054432.101197-2-sj@kernel.org>

> If a DAMOS scheme has a damos_quota_goal of zero target_value,
> damos_quota_goal() could trigger division-by-zero error.  Hence each
> DAMON API callers should do the zero target_value validation.  It is
> easy to make mistakes.  Actually such bugs in DAMON_LRU_SORT and
> DAMON_SAMPLE_MTIER were found and fixed [1].
> 
> It is better to handle the corner case only once in the core layer,
> instead of multiple places in all DAMON API callers.  One
> straightforward option is using an alternative denominator for the
> corner case in the damos_quota_goal().  However, the zero target_value
> is meaningless.  In this case, the quota goal is always evaluated as
> achieved or over-achieved.  The quota will only keep being reduced.
> 
> Simply avoid using zero target_value by adding a check in the core layer
> DAMOS quota goal parameters validation/commit path,
> damos_commit_quota_goal().  Update it to return an error in the case.
> Also update its caller to propagate the error.
> 
> [1] https://lore.kernel.org/20260803134034.15217-1-sj@kernel.org
> 
> Signed-off-by: SJ Park <sj@kernel.org>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813054432.101197-1-sj@kernel.org?part=1


  reply	other threads:[~2026-08-13  5:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  5:44 [RFC PATCH 0/3] mm/damon: move zero damos quota target_value handling to the core layer SJ Park
2026-08-13  5:44 ` [RFC PATCH 1/3] mm/damon/core: error damos_commit_quota_goal() for zero target_value SJ Park
2026-08-13  5:57   ` sashiko-bot [this message]
2026-08-13  5:44 ` [RFC PATCH 2/3] Revert "mm/damon/lru_sort: error out for >10000 active_mem_bp" SJ Park
2026-08-13  5:53   ` sashiko-bot
2026-08-13  5:44 ` [RFC PATCH 3/3] Revert "samples/damon/mtier: error out for zero quota goal target values" SJ Park
2026-08-13  5:57   ` sashiko-bot

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=20260813055733.E453E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --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;
as well as URLs for NNTP newsgroup(s).