Re: SMP linux help

list.kernel@iahastie.clara.net
Sun, 5 Sep 1999 19:04:09 +0200


Nathaniel G. Eldredge wrote:
> Okay, so "locking the kernel" is really a misnomer. It doesn't lock the
> whole kernel, just the sections protected by the kernel lock; and there's
> nothing more magical about the kernel lock than any other spinlock, it
> just protects more stuff. Got it.

Actually the kernel lock is different to other spinlocks.

When a task holding the kernel lock blocks, i.e. calls schedule(), the
lock is dropped. When the task is run again, the lock is reacquired.

Ordinary spinlocks are different. You must never call schedule() while
holding an ordinary spinlock. This means no wait_on_blah() or down()
calls in the critical region, and no non-atomic memory allocation.
These rules don't apply to semaphores used as mutexes.

(But don't take my word for it. I can be wrong ;), read the source.
See release_kernel_lock(), reacquire_kernel_lock() and related() in
sched.c).

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/