From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Steven Rostedt <rostedt@goodmis.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Nicholas Miell <nmiell@comcast.net>,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, josh@joshtriplett.org,
dvhltc@us.ibm.com, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, Valdis.Kletnieks@vt.edu,
dhowells@redhat.com, linux-kernel@vger.kernel.org,
Nick Piggin <npiggin@suse.de>,
Chris Friesen <cfriesen@nortel.com>,
Fr??d??ric Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH -tip] introduce sys_membarrier(): process-wide memory barrier (v9)
Date: Thu, 4 Mar 2010 12:56:59 -0500 [thread overview]
Message-ID: <20100304175659.GA3255@Krystal> (raw)
In-Reply-To: <alpine.LFD.2.00.1003040827100.7046@localhost.localdomain>
* Linus Torvalds (torvalds@linux-foundation.org) wrote:
> > - SA_RUNNING: a way to signal only running threads - as a way for user-space
> > based concurrency control mechanisms to deschedule running threads (or, like
> > in your case, to implement barrier / garbage collection schemes).
>
> Hmm. This sounds less fundamentally broken, but at the same time also
> _way_ more invasive in the signal handling layer. It's already one of our
> more "exciting" layers out there.
>
Hrm, thinking about it a bit further, the only way I see we could provide a
usable SA_RUNNING flag would be to add hooks to the scheduler. These hooks would
somehow have to call user-space code (!) when scheduling in/out a thread. Yes,
this sounds utterly broken (since these hooks would have to be preemptable).
The idea is this: if we look, for instance, at the kernel preemptable RCU
implementations, they consist of two parts: one is iteration on all CPUs to
consider all active CPUs, and the other is a modification of the scheduler to
note all preempted tasks that were in a preemptable RCU C.S..
Just for the memory barrier we consider for sys_membarrier(), I had to ensure
that the scheduler issues memory barriers to order accesses to user-space memory
and mm_cpumask modifications. In reality, what we are doing is to ensure that
the operation required on the running thread is done by the scheduler too when
scheduling in/out the task.
As soon as we have signal handlers which perform more than a simple memory
barrier (e.g. something that has side-effects outside of the processor), I doubt
it would ever make sense to only run the handler on running threads unless we
have hooks in the scheduler too.
Thanks,
Mathieu
--
Mathieu Desnoyers
Operating System Efficiency Consultant
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2010-03-04 17:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 23:23 [PATCH -tip] introduce sys_membarrier(): process-wide memory barrier (v9) Mathieu Desnoyers
2010-03-01 14:25 ` Mathieu Desnoyers
2010-03-02 17:52 ` Josh Triplett
2010-03-02 23:07 ` Mathieu Desnoyers
2010-03-03 1:53 ` Josh Triplett
2010-03-04 12:23 ` Ingo Molnar
2010-03-04 15:52 ` Mathieu Desnoyers
2010-03-04 16:03 ` Mathieu Desnoyers
2010-03-04 16:34 ` Linus Torvalds
2010-03-04 16:50 ` Paul E. McKenney
2010-03-04 17:56 ` Mathieu Desnoyers [this message]
2010-03-15 20:53 ` Mathieu Desnoyers
2010-03-16 7:36 ` Ingo Molnar
2010-03-16 7:57 ` Nick Piggin
2010-03-16 13:05 ` Mathieu Desnoyers
2010-03-16 13:13 ` Ingo Molnar
2010-03-16 13:35 ` Mathieu Desnoyers
2010-03-16 13:56 ` Ingo Molnar
2010-03-16 14:16 ` Mathieu Desnoyers
2010-03-04 20:23 ` Ingo Molnar
2010-03-06 19:43 ` Linus Torvalds
2010-03-09 6:59 ` Nick Piggin
2010-03-10 4:16 ` 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=20100304175659.GA3255@Krystal \
--to=mathieu.desnoyers@efficios.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=cfriesen@nortel.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhltc@us.ibm.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=nmiell@comcast.net \
--cc=npiggin@suse.de \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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