From: Nadav Amit <namit@vmware.com>
To: Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>
Cc: the arch/x86 maintainers <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Rik van Riel <riel@surriel.com>,
Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [PATCH v4 1/9] smp: Run functions concurrently in smp_call_function_many()
Date: Mon, 26 Aug 2019 16:25:58 +0000 [thread overview]
Message-ID: <98DE1002-07A4-450A-BE13-CE2B5D0CB89C@vmware.com> (raw)
In-Reply-To: <20190823224153.15223-2-namit@vmware.com>
> On Aug 23, 2019, at 3:41 PM, Nadav Amit <namit@vmware.com> wrote:
>
> Currently, on_each_cpu() and similar functions do not exploit the
> potential of concurrency: the function is first executed remotely and
> only then it is executed locally. Functions such as TLB flush can take
> considerable time, so this provides an opportunity for performance
> optimization.
>
> To do so, introduce __smp_call_function_many(), which allows the callers
> to provide local and remote functions that should be executed, and run
> them concurrently. Keep smp_call_function_many() semantic as it is today
> for backward compatibility: the called function is not executed in this
> case locally.
>
> __smp_call_function_many() does not use the optimized version for a
> single remote target that smp_call_function_single() implements. For
> synchronous function call, smp_call_function_single() keeps a
> call_single_data (which is used for synchronization) on the stack.
> Interestingly, it seems that not using this optimization provides
> greater performance improvements (greater speedup with a single remote
> target than with multiple ones). Presumably, holding data structures
> that are intended for synchronization on the stack can introduce
> overheads due to TLB misses and false-sharing when the stack is used for
> other purposes.
>
> Adding support to run the functions concurrently required to remove a
> micro-optimization in on_each_cpu() that disabled/enabled IRQs instead
> of saving/restoring them. The benefit of running the local and remote
> code concurrently is expected to be greater.
>
> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Rik van Riel <riel@surriel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Signed-off-by: Nadav Amit <namit@vmware.com>
> ---
> include/linux/smp.h | 34 ++++++++---
> kernel/smp.c | 138 +++++++++++++++++++++-----------------------
> 2 files changed, 92 insertions(+), 80 deletions(-)
>
> diff --git a/include/linux/smp.h b/include/linux/smp.h
> index 6fc856c9eda5..d18d54199635 100644
> --- a/include/linux/smp.h
> +++ b/include/linux/smp.h
> @@ -32,11 +32,6 @@ extern unsigned int total_cpus;
> int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
> int wait);
>
> -/*
> - * Call a function on all processors
> - */
> -void on_each_cpu(smp_call_func_t func, void *info, int wait);
> -
> /*
> * Call a function on processors specified by mask, which might include
> * the local one.
> @@ -44,6 +39,17 @@ void on_each_cpu(smp_call_func_t func, void *info, int wait);
> void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
> void *info, bool wait);
>
> +/*
> + * Call a function on all processors. May be used during early boot while
> + * early_boot_irqs_disabled is set.
> + */
> +static inline void on_each_cpu(smp_call_func_t func, void *info, int wait)
> +{
> + preempt_disable();
> + on_each_cpu_mask(cpu_online_mask, func, info, wait);
> + preempt_enable();
> +}
Err.. I made this change the last minute before sending, and apparently
forgot to build, since it does not build.
Let me know if there is anything else with this version, though.
next prev parent reply other threads:[~2019-08-26 16:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 22:41 [PATCH v4 0/9] x86/tlb: Concurrent TLB flushes Nadav Amit
2019-08-23 22:41 ` [PATCH v4 1/9] smp: Run functions concurrently in smp_call_function_many() Nadav Amit
2019-08-26 16:25 ` Nadav Amit [this message]
2019-08-23 22:41 ` [PATCH v4 2/9] x86/mm/tlb: Unify flush_tlb_func_local() and flush_tlb_func_remote() Nadav Amit
2019-08-23 22:41 ` [PATCH v4 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy() Nadav Amit
2019-08-23 22:41 ` [PATCH v4 4/9] x86/mm/tlb: Flush remote and local TLBs concurrently Nadav Amit
2019-08-23 22:41 ` [PATCH v4 5/9] x86/mm/tlb: Privatize cpu_tlbstate Nadav Amit
2019-08-23 22:41 ` [PATCH v4 6/9] x86/mm/tlb: Do not make is_lazy dirty for no reason Nadav Amit
2019-08-23 22:41 ` [PATCH v4 7/9] cpumask: Mark functions as pure Nadav Amit
2019-08-23 22:41 ` [PATCH v4 8/9] x86/mm/tlb: Remove UV special case Nadav Amit
2019-08-23 22:41 ` [PATCH v4 9/9] x86/mm/tlb: Remove unnecessary uses of the inline keyword Nadav Amit
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=98DE1002-07A4-450A-BE13-CE2B5D0CB89C@vmware.com \
--to=namit@vmware.com \
--cc=dave.hansen@linux.intel.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®