1 #ifndef __LINUX_SMPLOCK_H
2 #define __LINUX_SMPLOCK_H
4 #include <linux/config.h>
5 #include <linux/sched.h>
6 #include <linux/spinlock.h>
8 #ifdef CONFIG_LOCK_KERNEL
10 #define kernel_locked() (current->lock_depth >= 0)
12 extern int __lockfunc get_kernel_lock(void);
13 extern void __lockfunc put_kernel_lock(void);
16 * Release/re-acquire global kernel lock for the scheduler
18 #define release_kernel_lock(tsk) do { \
19 if (unlikely((tsk)->lock_depth >= 0)) \
24 * Non-SMP kernels will never block on the kernel lock,
25 * so we are better off returning a constant zero from
26 * reacquire_kernel_lock() so that the compiler can see
30 #define return_value_on_smp return
32 #define return_value_on_smp
35 static inline int reacquire_kernel_lock(struct task_struct *task)
37 if (unlikely(task->lock_depth >= 0))
38 return_value_on_smp get_kernel_lock();
42 extern void __lockfunc lock_kernel(void) __acquires(kernel_lock);
43 extern void __lockfunc unlock_kernel(void) __releases(kernel_lock);
47 #define lock_kernel() do { } while(0)
48 #define unlock_kernel() do { } while(0)
49 #define release_kernel_lock(task) do { } while(0)
50 #define reacquire_kernel_lock(task) 0
51 #define kernel_locked() 1
53 #endif /* CONFIG_LOCK_KERNEL */
54 #endif /* __LINUX_SMPLOCK_H */