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/thread_info.h>
11 #include <linux/linkage.h>
13 #ifdef CONFIG_DEBUG_PREEMPT
14 extern void fastcall
add_preempt_count(int val
);
15 extern void fastcall
sub_preempt_count(int val
);
17 # define add_preempt_count(val) do { preempt_count() += (val); } while (0)
18 # define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
21 #define inc_preempt_count() add_preempt_count(1)
22 #define dec_preempt_count() sub_preempt_count(1)
24 #define preempt_count() (current_thread_info()->preempt_count)
28 asmlinkage
void preempt_schedule(void);
30 #define preempt_disable() \
32 inc_preempt_count(); \
36 #define preempt_enable_no_resched() \
39 dec_preempt_count(); \
42 #define preempt_check_resched() \
44 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
48 #define preempt_enable() \
50 preempt_enable_no_resched(); \
52 preempt_check_resched(); \
57 #define preempt_disable() do { } while (0)
58 #define preempt_enable_no_resched() do { } while (0)
59 #define preempt_enable() do { } while (0)
60 #define preempt_check_resched() do { } while (0)
64 #endif /* __LINUX_PREEMPT_H */