1 /*
2 * <asm/smplock.h>
3 *
4 * Default SMP lock implementation
5 */
6 #include <linux/sched.h>
7 #include <linux/interrupt.h>
8
9 #include <asm/spinlock.h>
10
11 extern spinlock_t kernel_flag;
12
13 #define kernel_locked() spin_is_locked(&kernel_flag)
14
15 /*
16 * Release global kernel lock and global interrupt lock
17 */
18 static __inline__ void
19 release_kernel_lock(struct task_struct *task, int cpu)
20 {
21 if (task->lock_depth >= 0)
22 spin_unlock(&kernel_flag);
23 release_irqlock(cpu);
24 __sti();
25 }
26
27 /*
28 * Re-acquire the kernel lock
29 */
30 static __inline__ void
31 reacquire_kernel_lock(struct task_struct *task)
32 {
33 if (task->lock_depth >= 0)
34 spin_lock(&kernel_flag);
35 }
36
37 /*
38 * Getting the big kernel lock.
39 *
40 * This cannot happen asynchronously,
41 * so we only need to worry about other
42 * CPU's.
43 */
44 static __inline__ void
45 lock_kernel(void)
46 {
47 if (!++current->lock_depth)
48 spin_lock(&kernel_flag);
49 }
50
51 static __inline__ void
52 unlock_kernel(void)
53 {
54 if (--current->lock_depth < 0)
55 spin_unlock(&kernel_flag);
56 }
57
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.