4 * Default SMP lock implementation
6 #include <linux/sched.h>
7 #include <linux/interrupt.h>
8 #include <linux/spinlock.h>
10 extern spinlock_t kernel_flag;
12 #define kernel_locked() \
13 (spin_is_locked(&kernel_flag) &&\
14 (current->lock_depth >= 0))
17 * Release global kernel lock and global interrupt lock
19 #define release_kernel_lock(task, cpu) \
21 if (task->lock_depth >= 0) \
22 spin_unlock(&kernel_flag); \
23 release_irqlock(cpu); \
28 * Re-acquire the kernel lock
30 #define reacquire_kernel_lock(task) \
32 if (task->lock_depth >= 0) \
33 spin_lock(&kernel_flag); \
38 * Getting the big kernel lock.
40 * This cannot happen asynchronously,
41 * so we only need to worry about other
44 #define lock_kernel() \
46 if (!++current->lock_depth) \
47 spin_lock(&kernel_flag); \
50 #define unlock_kernel() \
52 if (--current->lock_depth < 0) \
53 spin_unlock(&kernel_flag); \