The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "tip-bot2 for Yury Norov [NVIDIA]" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Yury Norov [NVIDIA]" <yury.norov@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: smp/core] smp: Defer check for local execution in smp_call_function_many_cond()
Date: Wed, 02 Jul 2025 17:23:39 -0000	[thread overview]
Message-ID: <175147701995.406.2190759503320187064.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250623000010.10124-5-yury.norov@gmail.com>

The following commit has been merged into the smp/core branch of tip:

Commit-ID:     e0e9506523fea415e0d5abaa103fd67dc8a39696
Gitweb:        https://git.kernel.org/tip/e0e9506523fea415e0d5abaa103fd67dc8a39696
Author:        Yury Norov [NVIDIA] <yury.norov@gmail.com>
AuthorDate:    Sun, 22 Jun 2025 20:00:09 -04:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Jul 2025 19:13:14 +02:00

smp: Defer check for local execution in smp_call_function_many_cond()

Defer check for local execution to the actual place where it is needed,
which removes the extra local variable.

Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250623000010.10124-5-yury.norov@gmail.com

---
 kernel/smp.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 5871acf..99d1fd0 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -779,7 +779,6 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
 	bool wait = scf_flags & SCF_WAIT;
 	int nr_cpus = 0;
 	bool run_remote = false;
-	bool run_local = false;
 
 	lockdep_assert_preemption_disabled();
 
@@ -801,11 +800,6 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
 	 */
 	WARN_ON_ONCE(!in_task());
 
-	/* Check if we need local execution. */
-	if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
-	    (!cond_func || cond_func(this_cpu, info)))
-		run_local = true;
-
 	/* Check if we need remote execution, i.e., any CPU excluding this one. */
 	if (cpumask_any_and_but(mask, cpu_online_mask, this_cpu) < nr_cpu_ids) {
 		run_remote = true;
@@ -851,7 +845,9 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
 			send_call_function_ipi_mask(cfd->cpumask_ipi);
 	}
 
-	if (run_local) {
+	/* Check if we need local execution. */
+	if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
+	    (!cond_func || cond_func(this_cpu, info))) {
 		unsigned long flags;
 
 		local_irq_save(flags);

      parent reply	other threads:[~2025-07-02 17:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23  0:00 [PATCH v2 0/4] smp: Improve on cpumasks handling Yury Norov
2025-06-23  0:00 ` [PATCH v2 1/4] smp: Improve locality in smp_call_function_any() Yury Norov
2025-06-26 21:55   ` [tip: smp/core] " tip-bot2 for Yury Norov [NVIDIA]
2025-06-23  0:00 ` [PATCH v2 2/4] smp: Use cpumask_any_but() in smp_call_function_many_cond() Yury Norov
2025-06-26 21:55   ` [tip: smp/core] " tip-bot2 for Yury Norov [NVIDIA]
2025-06-23  0:00 ` [PATCH v2 3/4] smp: Don't wait for remote work done if not needed " Yury Norov
2025-06-26 21:55   ` [tip: smp/core] " tip-bot2 for Yury Norov [NVIDIA]
2025-06-23  0:00 ` [PATCH v2 4/4] smp: Defer check for local execution " Yury Norov
2025-06-26 21:55   ` [tip: smp/core] " tip-bot2 for Yury Norov [NVIDIA]
2025-07-02 17:23   ` tip-bot2 for Yury Norov [NVIDIA] [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=175147701995.406.2190759503320187064.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yury.norov@gmail.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