4 * Default SMP lock implementation
7 #include <linux/sched.h>
8 #include <linux/interrupt.h>
9 #include <linux/spinlock.h>
11 extern spinlock_t kernel_flag
;
14 * Release global kernel lock and global interrupt lock
16 static __inline__
void release_kernel_lock(struct task_struct
*task
, int cpu
)
18 if (task
->lock_depth
>= 0)
19 spin_unlock(&kernel_flag
);
25 * Re-acquire the kernel lock
27 static __inline__
void reacquire_kernel_lock(struct task_struct
*task
)
29 if (task
->lock_depth
>= 0)
30 spin_lock(&kernel_flag
);
34 * Getting the big kernel lock.
36 * This cannot happen asynchronously,
37 * so we only need to worry about other
40 static __inline__
void lock_kernel(void)
42 if (!++current
->lock_depth
)
43 spin_lock(&kernel_flag
);
46 static __inline__
void unlock_kernel(void)
48 if (--current
->lock_depth
< 0)
49 spin_unlock(&kernel_flag
);