mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Aveline Noir <jm5905938@gmail.com>
Cc: SJ 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: [BUG] DAMON_STAT: idle percentiles out of order on 32-bit
Date: Thu, 15 Oct 2026 07:13:19 -0700	[thread overview]
Message-ID: <20261015141319.88393-1-sj@kernel.org> (raw)
In-Reply-To: <CANOyQmHad1vamnZT12M5yPrJ69==Pt1U0+MGw6u0MuNtr-DRCw@mail.gmail.com>

Hi Avelin,

On Thu, 15 Oct 2026 04:24:12 -0700 Aveline Noir <jm5905938@gmail.com> wrote:

> Hi,
> 
> In an i386 QEMU guest built from mm-new commit ad9f2d463666,
> DAMON_STAT reported these memory_idle_ms_percentiles values after a
> statistics update:
> 
>   guest uptime:       22.51 s
>   aggr_interval_us:   3200000
>   percentile 0:      19200 ms
>   percentile 50:         0 ms
>   percentile 100:        0 ms
> 
> The 0th percentile is greater than the 50th and 100th.  The guest had
> 256 MiB of RAM (MemTotal: 254216 kB), a running kdamond,
> CONFIG_X86_32=y, CONFIG_DAMON_STAT=y,
> CONFIG_DAMON_STAT_ENABLED_DEFAULT=y, and CONFIG_COMPAT_32BIT_TIME=y.
> aggr_interval_us changed from 0 to 1600000 and then 3200000, showing
> that statistics updates ran before the final read.
> 
> In damon_stat_set_idletime_percentiles(), the loop compares
> 
>   next_percentile <= accounted_bytes * 100 / total_sz
> 
> where accounted_bytes and total_sz are unsigned long.  On 32-bit, when
> total_sz exceeds 42,949,672 bytes, the wrapped product cannot yield
> 100%, even after all bytes are accounted for.  Upper entries in
> memory_idle_ms_percentiles then retain an earlier value or remain zero
> on first use.  DAMON_STAT monitors the system RAM address range, which
> exceeds that threshold in this guest.  I did not capture a per-region
> trace in this run.
> 
> The guest init read the module parameters after 22 seconds of uptime;
> it did not write to them.  The i386 config, guest init, serial log, and
> build/run steps:

Could you share more details about your real use case that require the setup
and how this becomes a real problem?


Thanks,
SJ

[...]

  reply	other threads:[~2026-10-15 14:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 11:24 Aveline Noir
2026-10-15 14:13 ` SJ Park [this message]
2026-10-15 14:45   ` Aveline Noir

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=20261015141319.88393-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=jm5905938@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

all inboxes | Powered by JetHome®