All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "DaeMyung Kang" <charsyam@gmail.com>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH 3/3] mm/damon/core: avoid overflows in quota goal metrics and scores
Date: Tue, 27 Oct 2026 14:12:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-186714@kernel.org> (raw)
In-Reply-To: <20261027135932.2301646-4-charsyam@gmail.com>

> The node memory, node memcg memory, LRU [in]active memory, and hugepage
> memory quota goal metrics, as well as damos_quota_score(), use
> mult_frac() to scale a value by 10000.  mult_frac() multiplies the
> remainder by 10000 in unsigned long, which overflows on 32-bit kernels
> even when the result fits:
> 
> - For the page based metrics, this happens once the numerator exceeds
>   about 429,496 pages, or 1.6 GiB with 4 KiB pages.  For example, 2 GiB
>   used out of 3 GiB returns 1205 bp instead of 6666 bp.  The LRU
>   [in]active and hugepage metrics do not depend on NUMA.
> 
> - For quota goal scores, any current value above about 429,496 can
>   overflow.  For example, a DAMOS_QUOTA_SOME_MEM_PSI_US goal with a
>   target of one second and a current value of half a second returns 705
>   instead of 5000.  On any architecture, mult_frac() also silently wraps
> [ ... ]
> Fixes: 4835e2871321 ("mm/damon/core: introduce [in]active memory ratio damos quota goal metric")
> Fixes: f465dc71aba0 ("mm/damon: introduce DAMOS_QUOTA_HUGEPAGE auto tuning")
> Fixes: 9138e27a3bc3 ("mm/damon: add node_eligible_mem_bp goal metric")
> Fixes: 06ba5b309ed8 ("mm/damon/core: let goal specified with only target and current values")
> Signed-off-by: DaeMyung Kang <charsyam@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261027135932.2301646-1-charsyam@gmail.com?part=3


  reply	other threads:[~2026-10-27 14:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 13:59 [RFC PATCH 0/3] mm/damon: fix overflows in score and ratio calculations DaeMyung Kang
2026-10-27 13:59 ` [RFC PATCH 1/3] mm/damon/ops-common: avoid overflow in weighted hotness score DaeMyung Kang
2026-10-27 14:05   ` sashiko-bot
2026-10-27 13:59 ` [RFC PATCH 2/3] mm/damon/core: avoid overflows in monitoring results calculations DaeMyung Kang
2026-10-27 14:10   ` sashiko-bot
2026-10-27 14:18   ` Gutierrez Asier
2026-10-27 13:59 ` [RFC PATCH 3/3] mm/damon/core: avoid overflows in quota goal metrics and scores DaeMyung Kang
2026-10-27 14:12   ` sashiko-bot [this message]
2026-10-27 14:23 ` [RFC PATCH 0/3] mm/damon: fix overflows in score and ratio calculations 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=sashiko-outbox-186714@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=charsyam@gmail.com \
    --cc=damon@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.