public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Zhan Xusheng <zhanxusheng@xiaomi.com>
Subject: Re: [PATCH v4] sched/psi: Skip CPUs with zero non-idle delta in per-CPU aggregation
Date: Mon, 4 May 2026 10:04:34 +0200	[thread overview]
Message-ID: <20260504080434.GN3126523@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260429100555.179348-1-zhanxusheng@xiaomi.com>

On Wed, Apr 29, 2026 at 06:05:55PM +0800, Zhan Xusheng wrote:
> collect_percpu_times() iterates over every possible CPU to build a
> non-idle-weighted average of the PSI state times. When a CPU has
> no PSI_NONIDLE delta for the current sampling interval:
>   nonidle  = nsecs_to_jiffies(times[PSI_NONIDLE]) = 0
>   deltas[s] += times[s] * nonidle               /* += 0 */
> 
> so the weighted accumulation contributes nothing.
> 
> get_recent_times() already sets the PSI_NONIDLE bit in
> cpu_changed_states iff the PSI_NONIDLE delta is non-zero. Use that
> bit to skip such CPUs early, as suggested by Johannes, avoiding the
> nsecs_to_jiffies() call.
> 
> No functional change intended.

So presumably this is an optimization. Where is the data that justifies
this?

      reply	other threads:[~2026-05-04  8:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03 10:00 [PATCH] sched/psi: Skip CPUs with zero non-idle jiffies in per-cpu aggregation Zhan Xusheng
2026-02-03 16:46 ` Johannes Weiner
2026-02-04  2:23   ` [PATCH v2] sched/psi: Skip CPUs with zero non-idle jiffies in per-CPU aggregation Zhan Xusheng
2026-03-13  3:48     ` [PATCH v3] " Zhan Xusheng
2026-04-29 10:05   ` [PATCH v4] sched/psi: Skip CPUs with zero non-idle delta " Zhan Xusheng
2026-05-04  8:04     ` Peter Zijlstra [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=20260504080434.GN3126523@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=zhanxusheng1024@gmail.com \
    --cc=zhanxusheng@xiaomi.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