mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tao Cui <cui.tao@linux.dev>
To: guopeng.zhang@linux.dev
Cc: akpm@linux-foundation.org, bsegall@google.com,
	dietmar.eggemann@arm.com, hannes@cmpxchg.org,
	juri.lelli@redhat.com, kprateek.nayak@amd.com,
	linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com,
	peterz@infradead.org, rostedt@goodmis.org, surenb@google.com,
	vincent.guittot@linaro.org, vschneid@redhat.com,
	cui.tao@linux.dev, Tao Cui <cuitao@kylinos.cn>
Subject: Re: [PATCH 2/2] sched/psi: Fix overflow in trigger time conversion on 32-bit
Date: Tue, 28 Jul 2026 16:52:55 +0800	[thread overview]
Message-ID: <20260728085255.2366221-1-cui.tao@linux.dev> (raw)
In-Reply-To: <20260717102824.985950-3-guopeng.zhang@linux.dev>

From: Tao Cui <cuitao@kylinos.cn>

On Fri, Jul 17, 2026 at 3:29 AM Guopeng Zhang <guopeng.zhang@linux.dev> wrote:
>
> From: Guopeng Zhang <zhangguopeng@kylinos.cn>
>
> threshold_us and window_us are u32, while NSEC_PER_USEC is 1000L. On
> 32-bit architectures, multiplication by NSEC_PER_USEC is evaluated
> using 32-bit unsigned arithmetic and can wrap before the result is
> assigned to the u64 trigger fields.
>
> For a valid 4,000,000 us threshold and 6,000,000 us window, the
> threshold is stored as 4,000,000,000 ns, while the window wraps to
> 1,705,032,704 ns. The stored window is therefore shorter than the
> threshold, so the trigger no longer monitors the requested 4-second
> threshold over a 6-second window.
>
> Cast both values to u64 before the multiplication so that the
> conversion to nanoseconds is performed using 64-bit arithmetic.
>
> Fixes: 0e94682b73bf ("psi: introduce psi monitor")
> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>

Acked-by: Tao Cui <cuitao@kylinos.cn>

      parent reply	other threads:[~2026-07-28  8:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 10:28 [PATCH 0/2] sched/psi: Fix trigger time arithmetic Guopeng Zhang
2026-07-17 10:28 ` [PATCH 1/2] sched/psi: Fix long-window growth interpolation Guopeng Zhang
2026-07-27  3:17   ` Suren Baghdasaryan
2026-07-28  8:49   ` Tao Cui
2026-07-17 10:28 ` [PATCH 2/2] sched/psi: Fix overflow in trigger time conversion on 32-bit Guopeng Zhang
2026-07-27  3:24   ` Suren Baghdasaryan
2026-07-28  8:52   ` Tao Cui [this message]

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=20260728085255.2366221-1-cui.tao@linux.dev \
    --to=cui.tao@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=bsegall@google.com \
    --cc=cuitao@kylinos.cn \
    --cc=dietmar.eggemann@arm.com \
    --cc=guopeng.zhang@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=surenb@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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

Powered by JetHome