public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	zhanxusheng1024@gmail.com, zhanxusheng@xiaomi.com
Subject: Re: [PATCH v2] genirq/matrix: Clarify CPU selection logic
Date: Tue, 27 Jan 2026 09:37:55 +0100	[thread overview]
Message-ID: <87wm13bgd8.ffs@tglx> (raw)
In-Reply-To: <20260127024134.6872-1-zhanxusheng@xiaomi.com>

On Tue, Jan 27 2026 at 10:41, Zhan Xusheng wrote:
> The CPU selection logic in matrix_find_best_cpu() and
> matrix_find_best_cpu_managed() mixes eligibility checks with update
> conditions, making the actual selection criteria harder to reason
> about during review.
>
> Refactor both loops to separate the online check from the comparison
> itself and make the selection rules explicit. In
> matrix_find_best_cpu(), this is a pure readability change with no
> behavioral impact.
>
> In matrix_find_best_cpu_managed(), the refactoring also avoids updating
> best_cpu when CPUs have identical managed_allocated counts, removing an
> implicit tie-breaking behavior based on CPU iteration order.

... by replacing it with a different tie-breaking behaviour based on CPU
iteration order. What's the actual improvement here?

> The intended selection policy is unchanged, except that equal cases in
> the managed path no longer trigger redundant best_cpu updates.

You're doing two things at once. The selection logic change is
completely separate from the "polishing" and it's clearly documented
that functional changes have to be separated from others.

If your main objective is to adjust the tie-breaking logic, then you can
do that with a single character insertion plus a reasonable explanation
why it matters and leave the otherwise perfectly readable and
understandable code alone.

Thanks,

        tglx

  reply	other threads:[~2026-01-27  8:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27  2:41 [PATCH v2] genirq/matrix: Clarify CPU selection logic Zhan Xusheng
2026-01-27  8:37 ` Thomas Gleixner [this message]
2026-01-28  3:14   ` [PATCH v3 0/2] genirq/matrix: CPU selection cleanup and tie-breaking fix Zhan Xusheng
2026-01-28  3:14     ` [PATCH v3 1/2] genirq/matrix: Clarify CPU selection logic Zhan Xusheng
2026-01-28 11:11       ` Thomas Gleixner
2026-01-28  3:14     ` [PATCH v3 2/2] genirq/matrix: Avoid implicit tie-breaking by CPU iteration order Zhan Xusheng
2026-01-28 11:16       ` Thomas Gleixner

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=87wm13bgd8.ffs@tglx \
    --to=tglx@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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