Locking Schema next up previous contents
Next: Networking Schema Up: Current Schemata Previous: Scheduler Schema   Contents


Locking Schema

This schema tries to catch the essence of Linux's locking mechanism -- the subsystem used to achieve inter-processor mutual exclusion. Linux uses the busy-wait approach for locking, and three major lock type:

  1. spinlock: only allow one processor to execute a critical section at any given time.

  2. read/write spinlock: asymmetric locks, which allow multiple read-only contexts to execute simultaneously, while writers contexts get exclusive access.

  3. Big Kernel Lock (BKL), a relic from early SMP support in Linux, which was meant to be a transitional solution from the monolithic support (only one CPU running kernel code at any given time) to the fine grained support (separate locks for each global data structure). Although the BKL has been deemed a deprecated feature, it is still widely used in some parts of the kernel.

A more detailed discussion of locking in Linux can be found in [1] (and a general discussion in [6]).

The events included in this schema are:

  1. SPINLOCK_INIT
    A spinlock was initialized.

  2. SPINLOCK_FINISH
    A spinlock was released. This event also saves the time in which the lock was acquired.

  3. PREEMPT_SPINLOCK_FINISH
    A spinlock was released on kernel preemption. This event also saves the time in which the lock was acquired.

  4. RWLOCK_INIT
    A read/write lock was initialized.

  5. READLOCK_FINISH
    A spinlock was released from reader context. This event also saves the time in which the lock was acquired.

  6. WRITELOCK_FINISH
    A spinlock was released from writer context. This event also saves the time in which the lock was acquired.

  7. PREEMPT_WRITELOCK_FINISH
    A spinlock was released from writer context on kernel preemption. This event also saves the time in which the lock was acquired.

  8. BKL_LOCK_FINISH
    The BKL was released (again, also saving the in which time it was acquired).


next up previous contents
Next: Networking Schema Up: Current Schemata Previous: Scheduler Schema   Contents
Yoav Etsion 2007-09-09