tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MP locking?

On Wed, Jun 30, 2010 at 05:15:53PM -0400, der Mouse wrote:
> I have some kernel code which was written for a pre-MP kernel; it uses
> spl*() for locking.  I'd like to roll this forward to something at
> least slightly more modern - specifically, a dual-CPU 4.0.1 machine.
> lock(9) outlines locking facilities which I believe I can use to do
> what I want - but there are other issues, such as cache coherency; do I
> need to do anything special with shared data structures to ensure
> coherency between processors?  Is it enough to declare them volatile,
> or do I need memory barriers as well, or what?  To what extent can I
> use locks from within code invoked by callouts?

4.0 only runs MP deep in the guts of the kernel.  The vast majority
of it is single threaded so one can pretend that it's a traditional Unix
kernel.  You don't need to do anything.

5.0 is a very different beast and is fully multithreaded: preemptive
and with concurrent streams of execution.

Home | Main Index | Thread Index | Old Index