diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/preempt.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/preempt.h')
-rw-r--r-- | include/linux/preempt.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/include/linux/preempt.h b/include/linux/preempt.h new file mode 100644 index 000000000000..dd98c54a23b4 --- /dev/null +++ b/include/linux/preempt.h | |||
@@ -0,0 +1,62 @@ | |||
1 | #ifndef __LINUX_PREEMPT_H | ||
2 | #define __LINUX_PREEMPT_H | ||
3 | |||
4 | /* | ||
5 | * include/linux/preempt.h - macros for accessing and manipulating | ||
6 | * preempt_count (used for kernel preemption, interrupt count, etc.) | ||
7 | */ | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <linux/linkage.h> | ||
11 | |||
12 | #ifdef CONFIG_DEBUG_PREEMPT | ||
13 | extern void fastcall add_preempt_count(int val); | ||
14 | extern void fastcall sub_preempt_count(int val); | ||
15 | #else | ||
16 | # define add_preempt_count(val) do { preempt_count() += (val); } while (0) | ||
17 | # define sub_preempt_count(val) do { preempt_count() -= (val); } while (0) | ||
18 | #endif | ||
19 | |||
20 | #define inc_preempt_count() add_preempt_count(1) | ||
21 | #define dec_preempt_count() sub_preempt_count(1) | ||
22 | |||
23 | #define preempt_count() (current_thread_info()->preempt_count) | ||
24 | |||
25 | #ifdef CONFIG_PREEMPT | ||
26 | |||
27 | asmlinkage void preempt_schedule(void); | ||
28 | |||
29 | #define preempt_disable() \ | ||
30 | do { \ | ||
31 | inc_preempt_count(); \ | ||
32 | barrier(); \ | ||
33 | } while (0) | ||
34 | |||
35 | #define preempt_enable_no_resched() \ | ||
36 | do { \ | ||
37 | barrier(); \ | ||
38 | dec_preempt_count(); \ | ||
39 | } while (0) | ||
40 | |||
41 | #define preempt_check_resched() \ | ||
42 | do { \ | ||
43 | if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ | ||
44 | preempt_schedule(); \ | ||
45 | } while (0) | ||
46 | |||
47 | #define preempt_enable() \ | ||
48 | do { \ | ||
49 | preempt_enable_no_resched(); \ | ||
50 | preempt_check_resched(); \ | ||
51 | } while (0) | ||
52 | |||
53 | #else | ||
54 | |||
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) | ||
59 | |||
60 | #endif | ||
61 | |||
62 | #endif /* __LINUX_PREEMPT_H */ | ||