linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Local execution of ipi_sync_rq_state() on sync_runqueues_membarrier_state()
Date: Tue, 16 Feb 2021 13:35:23 -0800	[thread overview]
Message-ID: <74F1E842-4A84-47BF-B6C2-5407DFDD4A4A@gmail.com> (raw)

Hello Mathieu,

While trying to find some unrelated by, something in
sync_runqueues_membarrier_state() caught my eye:


  static int sync_runqueues_membarrier_state(struct mm_struct *mm)
  {
        if (atomic_read(&mm->mm_users) == 1 || num_online_cpus() == 1) {
                this_cpu_write(runqueues.membarrier_state, membarrier_state);

                /*
                 * For single mm user, we can simply issue a memory barrier
                 * after setting MEMBARRIER_STATE_GLOBAL_EXPEDITED in the
                 * mm and in the current runqueue to guarantee that no memory
                 * access following registration is reordered before
                 * registration. 
                 */
                smp_mb();
                return 0;
        }

 [ snip ]

  	smp_call_function_many(tmpmask, ipi_sync_rq_state, mm, 1);


And ipi_sync_rq_state() does:

	this_cpu_write(runqueues.membarrier_state,
                       atomic_read(&mm->membarrier_state));


So my question: are you aware smp_call_function_many() would not run
ipi_sync_rq_state() on the local CPU? Is that the intention of the code?

Thanks,
Nadav

             reply	other threads:[~2021-02-16 21:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 21:35 Nadav Amit [this message]
2021-02-17 14:54 ` Local execution of ipi_sync_rq_state() on sync_runqueues_membarrier_state() Mathieu Desnoyers
2021-03-01 10:16 ` [tip: sched/urgent] sched/membarrier: fix missing local execution of ipi_sync_rq_state() tip-bot2 for Mathieu Desnoyers
2021-03-06 11:42 ` [tip: sched/core] " tip-bot2 for Mathieu Desnoyers

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=74F1E842-4A84-47BF-B6C2-5407DFDD4A4A@gmail.com \
    --to=nadav.amit@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).