[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <15142.1262862297@redhat.com>
Date: Thu, 07 Jan 2010 11:04:57 +0000
From: David Howells <dhowells@...hat.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
Cc: dhowells@...hat.com, linux-kernel@...r.kernel.org,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...e.hu>, akpm@...ux-foundation.org,
josh@...htriplett.org, tglx@...utronix.de, peterz@...radead.org,
rostedt@...dmis.org, Valdis.Kletnieks@...edu, laijs@...fujitsu.com,
dipankar@...ibm.com
Subject: Re: [RFC PATCH] introduce sys_membarrier(): process-wide memory barrier
Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca> wrote:
> The current implementation simply executes a memory barrier in an IPI
> handler on each active cpu. Going through the hassle of taking run queue
> locks and checking if the thread running on each online CPU belongs to
> the current thread seems more heavyweight than the cost of the IPI
> itself (not measured though).
There's another way to do this:
(1) For each threads you want to execute a memory barrier, mark in its
task_struct that you want it to do a memory barrier and set
TIF_NOTIFY_RESUME.
(2) Interrupt all CPUs. The interrupt handler doesn't have to do anything.
(3) When any of the threads marked in (1) gain CPU time, do_notify_resume()
will be executed, and the do-memory-barrier flag can be tested and if it
was set, the flag can be cleared and a memory barrier can be
interpolated.
The current thread will also pass through stage (3) on its way out, if it's
marked in stage (1).
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists