1 #ifndef __LINUX_PREEMPT_H
2 #define __LINUX_PREEMPT_H
5 * include/linux/preempt.h - macros for accessing and manipulating
6 * preempt_count (used for kernel preemption, interrupt count, etc.)
9 #include <linux/config.h>
10 #include <linux/linkage.h>
12 #ifdef CONFIG_DEBUG_PREEMPT
13 extern void fastcall add_preempt_count(int val);
14 extern void fastcall sub_preempt_count(int val);
16 # define add_preempt_count(val) do { preempt_count() += (val); } while (0)
17 # define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
20 #define inc_preempt_count() add_preempt_count(1)
21 #define dec_preempt_count() sub_preempt_count(1)
23 #define preempt_count() (current_thread_info()->preempt_count)
27 asmlinkage void preempt_schedule(void);
29 #define preempt_disable() \
31 inc_preempt_count(); \
35 #define preempt_enable_no_resched() \
38 dec_preempt_count(); \
41 #define preempt_check_resched() \
43 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
47 #define preempt_enable() \
49 preempt_enable_no_resched(); \
50 preempt_check_resched(); \
55 #define preempt_disable() do { } while (0)
56 #define preempt_enable_no_resched() do { } while (0)
57 #define preempt_enable() do { } while (0)
58 #define preempt_check_resched() do { } while (0)
62 #endif /* __LINUX_PREEMPT_H */