public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: peterz@infradead.org
To: George Prekas <prekageo@amazon.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Peter Xu <peterx@redhat.com>, Kaitao Cheng <pilgrimtao@gmail.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] latency improvement in __smp_call_single_queue
Date: Thu, 24 Sep 2020 10:42:15 +0200	[thread overview]
Message-ID: <20200924084215.GD1362448@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <281da382-4511-e1df-6917-154a5914dd43@amazon.com>

On Wed, Sep 23, 2020 at 10:00:41AM -0500, George Prekas wrote:
> If an interrupt arrives between llist_add and
> send_call_function_single_ipi in the following code snippet, then the
> remote CPU will not receive the IPI in a timely manner and subsequent
> SMP calls even from other CPUs for other functions will be delayed:
> 
>     if (llist_add(node, &per_cpu(call_single_queue, cpu)))
>         send_call_function_single_ipi(cpu);
> 
> Note: llist_add returns 1 if it was empty before the operation.
> 
> CPU 0                           | CPU 1                     | CPU 2
> __smp_call_single_q(2,f1)       | __smp_call_single_q(2,f2) |
>   llist_add returns 1           |                           |
>   interrupted                   |   llist_add returns 0     |
>       ...                       |   branch not taken        |
>       ...                       |                           |
>   resumed                       |                           |
>   send_call_function_single_ipi |                           |
>                                 |                           | f1
>                                 |                           | f2
> 
> The call from CPU 1 for function f2 will be delayed because CPU 0 was
> interrupted.

Do you happen to have any actual numbers and a use-case where this was
relevant?

  reply	other threads:[~2020-09-24  8:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 15:00 [PATCH] latency improvement in __smp_call_single_queue George Prekas
2020-09-24  8:42 ` peterz [this message]
2020-09-24 15:04   ` George Prekas

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=20200924084215.GD1362448@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterx@redhat.com \
    --cc=pilgrimtao@gmail.com \
    --cc=prekageo@amazon.com \
    --cc=tglx@linutronix.de \
    /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