lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210302070502.GA2809110@gmail.com>
Date:   Tue, 2 Mar 2021 08:05:02 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Nadav Amit <nadav.amit@...il.com>, linux-kernel@...r.kernel.org,
        Andy Lutomirski <luto@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Nadav Amit <namit@...are.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Rik van Riel <riel@...riel.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: [PATCH] smp: Micro-optimize smp_call_function_many_cond()


* Peter Zijlstra <peterz@...radead.org> wrote:

> On Sat, Feb 20, 2021 at 03:17:04PM -0800, Nadav Amit wrote:
> > +		/*
> > +		 * Choose the most efficient way to send an IPI. Note that the
> > +		 * number of CPUs might be zero due to concurrent changes to the
> > +		 * provided mask.
> > +		 */
> > +		if (nr_cpus == 1)
> > +			arch_send_call_function_single_ipi(last_cpu);
> > +		else if (likely(nr_cpus > 1))
> > +			arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
> 
> I just ran into conflicts with another patch set, and noticed that the
> above should probably be:
> 
> 		if (nr_cpus == 1)
> 			send_call_function_single_ipi(last_cpu);
> 		else if (likely(nr_cpus > 1))
> 			arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
> 
> Which will avoid the IPI when @last_cpu is idle.

I turned this into the additional patch below, on top of Nadav's series.

Thanks,

	Ingo

===============>
From: Ingo Molnar <mingo@...nel.org>
Date: Tue, 2 Mar 2021 08:02:43 +0100
Subject: [PATCH] smp: Micro-optimize smp_call_function_many_cond()

Call the generic send_call_function_single_ipi() function, which
will avoid the IPI when @last_cpu is idle.

Signed-off-by: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org
---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index b6375d775e93..af0d51da84a2 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -694,7 +694,7 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
 		 * provided mask.
 		 */
 		if (nr_cpus == 1)
-			arch_send_call_function_single_ipi(last_cpu);
+			send_call_function_single_ipi(last_cpu);
 		else if (likely(nr_cpus > 1))
 			arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
 	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ