Thread (17 messages) flat view 17 messages, 7 authors, 2017-10-07

Re: [PATCH tip/core/rcu 1/3] membarrier: Provide register expedited private command

From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: 2017-10-05 16:03:43
Also in: linux-arch, lkml

----- On Oct 5, 2017, at 8:24 AM, Peter Zijlstra peterz@infradead.org wrote:
On Thu, Oct 05, 2017 at 02:12:50PM +0200, Peter Zijlstra wrote:
quoted
On Wed, Oct 04, 2017 at 02:37:53PM -0700, Paul E. McKenney wrote:
quoted
diff --git a/arch/powerpc/kernel/membarrier.c b/arch/powerpc/kernel/membarrier.c
new file mode 100644
index 000000000000..b0d79a5f5981
--- /dev/null
+++ b/arch/powerpc/kernel/membarrier.c
@@ -0,0 +1,45 @@
quoted
+void membarrier_arch_register_private_expedited(struct task_struct *p)
+{
+	struct task_struct *t;
+
+	if (get_nr_threads(p) == 1) {
+		set_thread_flag(TIF_MEMBARRIER_PRIVATE_EXPEDITED);
+		return;
+	}
+	/*
+	 * Coherence of TIF_MEMBARRIER_PRIVATE_EXPEDITED against thread
+	 * fork is protected by siglock.
+	 */
+	spin_lock(&p->sighand->siglock);
+	for_each_thread(p, t)
+		set_ti_thread_flag(task_thread_info(t),
+				TIF_MEMBARRIER_PRIVATE_EXPEDITED);
I'm not sure this works correctly vs CLONE_VM without CLONE_THREAD.
Also, for easier reading I would suggest putting { } around the block.
Will do, thanks,

Mathieu
quoted
quoted
+	spin_unlock(&p->sighand->siglock);
+	/*
+	 * Ensure all future scheduler executions will observe the new
+	 * thread flag state for this process.
+	 */
+	synchronize_sched();
This relies on the flag being read inside rq->lock, right?
quoted
+}
-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help