All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Hunter <ahh@google.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Avi Kivity <avi@scylladb.com>,
	Maged Michael <maged.michael@gmail.com>,
	Geoffrey Romer <gromer@google.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: Udpated sys_membarrier() speedup patch, FYI
Date: Fri, 28 Jul 2017 10:15:49 -0700	[thread overview]
Message-ID: <CADroS=6Xs9g5k+uiUtC_K=GbfGTMwtn2UGrj+d57WD+kkNNidQ@mail.gmail.com> (raw)
In-Reply-To: <20170727194322.GL3730@linux.vnet.ibm.com>

On Thu, Jul 27, 2017 at 12:43 PM, Paul E. McKenney
<paulmck@linux.vnet.ibm.com> wrote:
> On Thu, Jul 27, 2017 at 10:20:14PM +0300, Avi Kivity wrote:
>> IPIing only running threads of my process would be perfect. In fact
>> I might even be able to make use of "membarrier these threads
>> please" to reduce IPIs, when I change the topology from fully
>> connected to something more sparse, on larger machines.
>>

We do this as well--sometimes we only need RSEQ fences against
specific CPU(s), and thus pass a subset.

> +static void membarrier_private_expedited_ipi_each(void)
> +{
> +       int cpu;
> +
> +       for_each_online_cpu(cpu) {
> +               struct task_struct *p;
> +
> +               rcu_read_lock();
> +               p = task_rcu_dereference(&cpu_rq(cpu)->curr);
> +               if (p && p->mm == current->mm)
> +                       smp_call_function_single(cpu, ipi_mb, NULL, 1);
> +               rcu_read_unlock();
> +       }
> +}
> +

We have the (simpler imho)

const struct cpumask *mask = mm_cpumask(mm);
/* possibly AND it with a user requested mask */
smp_call_function_many(mask, ipi_func, ....);

which I think will be faster on some archs (that support broadcast)
and have fewer problems with out of sync values (though we do have to
check in our IPI function that we haven't context switched out.

Am I missing why this won't work?

  parent reply	other threads:[~2017-07-28 17:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27 18:12 Udpated sys_membarrier() speedup patch, FYI Paul E. McKenney
2017-07-27 18:36 ` Andrew Hunter
2017-07-27 19:06   ` Paul E. McKenney
2017-07-28 17:37     ` Andrew Hunter
2017-07-28 18:14       ` Paul E. McKenney
2017-07-27 19:20 ` Avi Kivity
2017-07-27 19:43   ` Paul E. McKenney
2017-07-27 20:04     ` Avi Kivity
2017-07-27 20:37       ` Paul E. McKenney
2017-07-27 20:58         ` Mathieu Desnoyers
2017-07-27 21:02           ` Mathieu Desnoyers
2017-07-31  6:03             ` Avi Kivity
2017-07-31  8:37               ` Peter Zijlstra
2017-07-31  8:53                 ` Avi Kivity
2017-07-28 17:15     ` Andrew Hunter [this message]
2017-07-28 17:25       ` Mathieu Desnoyers
2017-07-28 17:31       ` Paul E. McKenney
2017-07-28 17:48         ` Mathieu Desnoyers
2017-07-31 18:00 ` Dave Watson
2017-07-31 18:27   ` Paul E. McKenney

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='CADroS=6Xs9g5k+uiUtC_K=GbfGTMwtn2UGrj+d57WD+kkNNidQ@mail.gmail.com' \
    --to=ahh@google.com \
    --cc=avi@scylladb.com \
    --cc=gromer@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maged.michael@gmail.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.