diff options
author | Peter Zijlstra <peterz@infradead.org> | 2013-08-14 08:55:40 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-09-25 08:07:50 -0400 |
commit | a787870924dbd6f321661e06d4ec1c7a408c9ccf (patch) | |
tree | 43aae13f34d21b001efd4a4a4e64f3d085988bad | |
parent | f27dde8deef33c9e58027df11ceab2198601d6a6 (diff) |
sched, arch: Create asm/preempt.h
In order to prepare to per-arch implementations of preempt_count move
the required bits into an asm-generic header and use this for all
archs.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-h5j0c1r3e3fk015m30h8f1zx@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
32 files changed, 85 insertions, 48 deletions
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild index a6e85f448c1c..f01fb505ad52 100644 --- a/arch/alpha/include/asm/Kbuild +++ b/arch/alpha/include/asm/Kbuild | |||
@@ -3,3 +3,4 @@ generic-y += clkdev.h | |||
3 | 3 | ||
4 | generic-y += exec.h | 4 | generic-y += exec.h |
5 | generic-y += trace_clock.h | 5 | generic-y += trace_clock.h |
6 | generic-y += preempt.h | ||
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index d8dd660898b9..5943f7f9d325 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild | |||
@@ -46,3 +46,4 @@ generic-y += ucontext.h | |||
46 | generic-y += user.h | 46 | generic-y += user.h |
47 | generic-y += vga.h | 47 | generic-y += vga.h |
48 | generic-y += xor.h | 48 | generic-y += xor.h |
49 | generic-y += preempt.h | ||
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild index d3db39860b9c..4e6838d4ddf6 100644 --- a/arch/arm/include/asm/Kbuild +++ b/arch/arm/include/asm/Kbuild | |||
@@ -33,3 +33,4 @@ generic-y += timex.h | |||
33 | generic-y += trace_clock.h | 33 | generic-y += trace_clock.h |
34 | generic-y += types.h | 34 | generic-y += types.h |
35 | generic-y += unaligned.h | 35 | generic-y += unaligned.h |
36 | generic-y += preempt.h | ||
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index 79a642d199f2..519f89f5b6a3 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild | |||
@@ -50,3 +50,4 @@ generic-y += unaligned.h | |||
50 | generic-y += user.h | 50 | generic-y += user.h |
51 | generic-y += vga.h | 51 | generic-y += vga.h |
52 | generic-y += xor.h | 52 | generic-y += xor.h |
53 | generic-y += preempt.h | ||
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild index d22af851f3f6..b946080ee8bb 100644 --- a/arch/avr32/include/asm/Kbuild +++ b/arch/avr32/include/asm/Kbuild | |||
@@ -3,3 +3,4 @@ generic-y += clkdev.h | |||
3 | generic-y += exec.h | 3 | generic-y += exec.h |
4 | generic-y += trace_clock.h | 4 | generic-y += trace_clock.h |
5 | generic-y += param.h | 5 | generic-y += param.h |
6 | generic-y += preempt.h | ||
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild index 127826f8a375..f2b43474b0e2 100644 --- a/arch/blackfin/include/asm/Kbuild +++ b/arch/blackfin/include/asm/Kbuild | |||
@@ -44,3 +44,4 @@ generic-y += ucontext.h | |||
44 | generic-y += unaligned.h | 44 | generic-y += unaligned.h |
45 | generic-y += user.h | 45 | generic-y += user.h |
46 | generic-y += xor.h | 46 | generic-y += xor.h |
47 | generic-y += preempt.h | ||
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild index e49f918531ad..fc0b3c356027 100644 --- a/arch/c6x/include/asm/Kbuild +++ b/arch/c6x/include/asm/Kbuild | |||
@@ -56,3 +56,4 @@ generic-y += ucontext.h | |||
56 | generic-y += user.h | 56 | generic-y += user.h |
57 | generic-y += vga.h | 57 | generic-y += vga.h |
58 | generic-y += xor.h | 58 | generic-y += xor.h |
59 | generic-y += preempt.h | ||
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild index c8325455520e..b06caf649a95 100644 --- a/arch/cris/include/asm/Kbuild +++ b/arch/cris/include/asm/Kbuild | |||
@@ -11,3 +11,4 @@ generic-y += module.h | |||
11 | generic-y += trace_clock.h | 11 | generic-y += trace_clock.h |
12 | generic-y += vga.h | 12 | generic-y += vga.h |
13 | generic-y += xor.h | 13 | generic-y += xor.h |
14 | generic-y += preempt.h | ||
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild index c5d767028306..74742dc6a3da 100644 --- a/arch/frv/include/asm/Kbuild +++ b/arch/frv/include/asm/Kbuild | |||
@@ -2,3 +2,4 @@ | |||
2 | generic-y += clkdev.h | 2 | generic-y += clkdev.h |
3 | generic-y += exec.h | 3 | generic-y += exec.h |
4 | generic-y += trace_clock.h | 4 | generic-y += trace_clock.h |
5 | generic-y += preempt.h | ||
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index 8ada3cf0c98d..7e0e7213a481 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild | |||
@@ -6,3 +6,4 @@ generic-y += mmu.h | |||
6 | generic-y += module.h | 6 | generic-y += module.h |
7 | generic-y += trace_clock.h | 7 | generic-y += trace_clock.h |
8 | generic-y += xor.h | 8 | generic-y += xor.h |
9 | generic-y += preempt.h | ||
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild index 1da17caac23c..67c3450309b7 100644 --- a/arch/hexagon/include/asm/Kbuild +++ b/arch/hexagon/include/asm/Kbuild | |||
@@ -53,3 +53,4 @@ generic-y += types.h | |||
53 | generic-y += ucontext.h | 53 | generic-y += ucontext.h |
54 | generic-y += unaligned.h | 54 | generic-y += unaligned.h |
55 | generic-y += xor.h | 55 | generic-y += xor.h |
56 | generic-y += preempt.h | ||
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild index a3456f34f672..f93ee087e8fe 100644 --- a/arch/ia64/include/asm/Kbuild +++ b/arch/ia64/include/asm/Kbuild | |||
@@ -3,4 +3,5 @@ generic-y += clkdev.h | |||
3 | generic-y += exec.h | 3 | generic-y += exec.h |
4 | generic-y += kvm_para.h | 4 | generic-y += kvm_para.h |
5 | generic-y += trace_clock.h | 5 | generic-y += trace_clock.h |
6 | generic-y += preempt.h | ||
6 | generic-y += vtime.h \ No newline at end of file | 7 | generic-y += vtime.h \ No newline at end of file |
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild index bebdc36ebb0a..2b58c5f0bc38 100644 --- a/arch/m32r/include/asm/Kbuild +++ b/arch/m32r/include/asm/Kbuild | |||
@@ -3,3 +3,4 @@ generic-y += clkdev.h | |||
3 | generic-y += exec.h | 3 | generic-y += exec.h |
4 | generic-y += module.h | 4 | generic-y += module.h |
5 | generic-y += trace_clock.h | 5 | generic-y += trace_clock.h |
6 | generic-y += preempt.h | ||
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 09d77a862da3..a5d27f272a59 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
@@ -31,3 +31,4 @@ generic-y += trace_clock.h | |||
31 | generic-y += types.h | 31 | generic-y += types.h |
32 | generic-y += word-at-a-time.h | 32 | generic-y += word-at-a-time.h |
33 | generic-y += xor.h | 33 | generic-y += xor.h |
34 | generic-y += preempt.h | ||
diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild index 6ae0ccb632cb..84d0c1d6b9b3 100644 --- a/arch/metag/include/asm/Kbuild +++ b/arch/metag/include/asm/Kbuild | |||
@@ -52,3 +52,4 @@ generic-y += unaligned.h | |||
52 | generic-y += user.h | 52 | generic-y += user.h |
53 | generic-y += vga.h | 53 | generic-y += vga.h |
54 | generic-y += xor.h | 54 | generic-y += xor.h |
55 | generic-y += preempt.h | ||
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild index d3c51a6a601d..ce0bbf8f5640 100644 --- a/arch/microblaze/include/asm/Kbuild +++ b/arch/microblaze/include/asm/Kbuild | |||
@@ -3,3 +3,4 @@ generic-y += clkdev.h | |||
3 | generic-y += exec.h | 3 | generic-y += exec.h |
4 | generic-y += trace_clock.h | 4 | generic-y += trace_clock.h |
5 | generic-y += syscalls.h | 5 | generic-y += syscalls.h |
6 | generic-y += preempt.h | ||
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild index 454ddf9bb76f..1acbb8b77a71 100644 --- a/arch/mips/include/asm/Kbuild +++ b/arch/mips/include/asm/Kbuild | |||
@@ -11,5 +11,6 @@ generic-y += sections.h | |||
11 | generic-y += segment.h | 11 | generic-y += segment.h |
12 | generic-y += serial.h | 12 | generic-y += serial.h |
13 | generic-y += trace_clock.h | 13 | generic-y += trace_clock.h |
14 | generic-y += preempt.h | ||
14 | generic-y += ucontext.h | 15 | generic-y += ucontext.h |
15 | generic-y += xor.h | 16 | generic-y += xor.h |
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild index c5d767028306..74742dc6a3da 100644 --- a/arch/mn10300/include/asm/Kbuild +++ b/arch/mn10300/include/asm/Kbuild | |||
@@ -2,3 +2,4 @@ | |||
2 | generic-y += clkdev.h | 2 | generic-y += clkdev.h |
3 | generic-y += exec.h | 3 | generic-y += exec.h |
4 | generic-y += trace_clock.h | 4 | generic-y += trace_clock.h |
5 | generic-y += preempt.h | ||
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild index 195653e851da..78405625e799 100644 --- a/arch/openrisc/include/asm/Kbuild +++ b/arch/openrisc/include/asm/Kbuild | |||
@@ -67,3 +67,4 @@ generic-y += ucontext.h | |||
67 | generic-y += user.h | 67 | generic-y += user.h |
68 | generic-y += word-at-a-time.h | 68 | generic-y += word-at-a-time.h |
69 | generic-y += xor.h | 69 | generic-y += xor.h |
70 | generic-y += preempt.h | ||
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild index ff4c9faed546..a603b9ebe54c 100644 --- a/arch/parisc/include/asm/Kbuild +++ b/arch/parisc/include/asm/Kbuild | |||
@@ -4,3 +4,4 @@ generic-y += word-at-a-time.h auxvec.h user.h cputime.h emergency-restart.h \ | |||
4 | div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \ | 4 | div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \ |
5 | poll.h xor.h clkdev.h exec.h | 5 | poll.h xor.h clkdev.h exec.h |
6 | generic-y += trace_clock.h | 6 | generic-y += trace_clock.h |
7 | generic-y += preempt.h | ||
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild index 704e6f10ae80..d8f9d2f18a23 100644 --- a/arch/powerpc/include/asm/Kbuild +++ b/arch/powerpc/include/asm/Kbuild | |||
@@ -2,4 +2,5 @@ | |||
2 | generic-y += clkdev.h | 2 | generic-y += clkdev.h |
3 | generic-y += rwsem.h | 3 | generic-y += rwsem.h |
4 | generic-y += trace_clock.h | 4 | generic-y += trace_clock.h |
5 | generic-y += preempt.h | ||
5 | generic-y += vtime.h \ No newline at end of file | 6 | generic-y += vtime.h \ No newline at end of file |
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild index f313f9cbcf44..7a5288f3479a 100644 --- a/arch/s390/include/asm/Kbuild +++ b/arch/s390/include/asm/Kbuild | |||
@@ -2,3 +2,4 @@ | |||
2 | 2 | ||
3 | generic-y += clkdev.h | 3 | generic-y += clkdev.h |
4 | generic-y += trace_clock.h | 4 | generic-y += trace_clock.h |
5 | generic-y += preempt.h | ||
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild index e1c7bb999b06..f3414ade77a3 100644 --- a/arch/score/include/asm/Kbuild +++ b/arch/score/include/asm/Kbuild | |||
@@ -4,3 +4,4 @@ header-y += | |||
4 | generic-y += clkdev.h | 4 | generic-y += clkdev.h |
5 | generic-y += trace_clock.h | 5 | generic-y += trace_clock.h |
6 | generic-y += xor.h | 6 | generic-y += xor.h |
7 | generic-y += preempt.h | ||
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index 280bea9e5e2b..231efbb68108 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild | |||
@@ -34,3 +34,4 @@ generic-y += termios.h | |||
34 | generic-y += trace_clock.h | 34 | generic-y += trace_clock.h |
35 | generic-y += ucontext.h | 35 | generic-y += ucontext.h |
36 | generic-y += xor.h | 36 | generic-y += xor.h |
37 | generic-y += preempt.h | ||
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild index 7e4a97fbded4..bf390667657a 100644 --- a/arch/sparc/include/asm/Kbuild +++ b/arch/sparc/include/asm/Kbuild | |||
@@ -16,3 +16,4 @@ generic-y += serial.h | |||
16 | generic-y += trace_clock.h | 16 | generic-y += trace_clock.h |
17 | generic-y += types.h | 17 | generic-y += types.h |
18 | generic-y += word-at-a-time.h | 18 | generic-y += word-at-a-time.h |
19 | generic-y += preempt.h | ||
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild index 664d6ad23f80..22f3bd147fa7 100644 --- a/arch/tile/include/asm/Kbuild +++ b/arch/tile/include/asm/Kbuild | |||
@@ -38,3 +38,4 @@ generic-y += termios.h | |||
38 | generic-y += trace_clock.h | 38 | generic-y += trace_clock.h |
39 | generic-y += types.h | 39 | generic-y += types.h |
40 | generic-y += xor.h | 40 | generic-y += xor.h |
41 | generic-y += preempt.h | ||
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index b30f34a79882..fdde187e6087 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild | |||
@@ -3,3 +3,4 @@ generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h | |||
3 | generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h | 3 | generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h |
4 | generic-y += switch_to.h clkdev.h | 4 | generic-y += switch_to.h clkdev.h |
5 | generic-y += trace_clock.h | 5 | generic-y += trace_clock.h |
6 | generic-y += preempt.h | ||
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild index 89d8b6c4e39a..00045cbe5c63 100644 --- a/arch/unicore32/include/asm/Kbuild +++ b/arch/unicore32/include/asm/Kbuild | |||
@@ -60,3 +60,4 @@ generic-y += unaligned.h | |||
60 | generic-y += user.h | 60 | generic-y += user.h |
61 | generic-y += vga.h | 61 | generic-y += vga.h |
62 | generic-y += xor.h | 62 | generic-y += xor.h |
63 | generic-y += preempt.h | ||
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild index 7f669853317a..eca20286a91c 100644 --- a/arch/x86/include/asm/Kbuild +++ b/arch/x86/include/asm/Kbuild | |||
@@ -5,3 +5,4 @@ genhdr-y += unistd_64.h | |||
5 | genhdr-y += unistd_x32.h | 5 | genhdr-y += unistd_x32.h |
6 | 6 | ||
7 | generic-y += clkdev.h | 7 | generic-y += clkdev.h |
8 | generic-y += preempt.h | ||
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild index 1b982641ec35..228d6aee3a16 100644 --- a/arch/xtensa/include/asm/Kbuild +++ b/arch/xtensa/include/asm/Kbuild | |||
@@ -28,3 +28,4 @@ generic-y += termios.h | |||
28 | generic-y += topology.h | 28 | generic-y += topology.h |
29 | generic-y += trace_clock.h | 29 | generic-y += trace_clock.h |
30 | generic-y += xor.h | 30 | generic-y += xor.h |
31 | generic-y += preempt.h | ||
diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h new file mode 100644 index 000000000000..a1fc6590a743 --- /dev/null +++ b/include/asm-generic/preempt.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #ifndef __ASM_PREEMPT_H | ||
2 | #define __ASM_PREEMPT_H | ||
3 | |||
4 | #include <linux/thread_info.h> | ||
5 | |||
6 | /* | ||
7 | * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users | ||
8 | * that think a non-zero value indicates we cannot preempt. | ||
9 | */ | ||
10 | static __always_inline int preempt_count(void) | ||
11 | { | ||
12 | return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED; | ||
13 | } | ||
14 | |||
15 | static __always_inline int *preempt_count_ptr(void) | ||
16 | { | ||
17 | return ¤t_thread_info()->preempt_count; | ||
18 | } | ||
19 | |||
20 | /* | ||
21 | * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the | ||
22 | * alternative is loosing a reschedule. Better schedule too often -- also this | ||
23 | * should be a very rare operation. | ||
24 | */ | ||
25 | static __always_inline void preempt_count_set(int pc) | ||
26 | { | ||
27 | *preempt_count_ptr() = pc; | ||
28 | } | ||
29 | |||
30 | /* | ||
31 | * We fold the NEED_RESCHED bit into the preempt count such that | ||
32 | * preempt_enable() can decrement and test for needing to reschedule with a | ||
33 | * single instruction. | ||
34 | * | ||
35 | * We invert the actual bit, so that when the decrement hits 0 we know we both | ||
36 | * need to resched (the bit is cleared) and can resched (no preempt count). | ||
37 | */ | ||
38 | |||
39 | static __always_inline void set_preempt_need_resched(void) | ||
40 | { | ||
41 | *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED; | ||
42 | } | ||
43 | |||
44 | static __always_inline void clear_preempt_need_resched(void) | ||
45 | { | ||
46 | *preempt_count_ptr() |= PREEMPT_NEED_RESCHED; | ||
47 | } | ||
48 | |||
49 | static __always_inline bool test_preempt_need_resched(void) | ||
50 | { | ||
51 | return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED); | ||
52 | } | ||
53 | |||
54 | #endif /* __ASM_PREEMPT_H */ | ||
diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 92e341853e4b..df8e245e8729 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h | |||
@@ -6,7 +6,6 @@ | |||
6 | * preempt_count (used for kernel preemption, interrupt count, etc.) | 6 | * preempt_count (used for kernel preemption, interrupt count, etc.) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/thread_info.h> | ||
10 | #include <linux/linkage.h> | 9 | #include <linux/linkage.h> |
11 | #include <linux/list.h> | 10 | #include <linux/list.h> |
12 | 11 | ||
@@ -16,53 +15,7 @@ | |||
16 | */ | 15 | */ |
17 | #define PREEMPT_NEED_RESCHED 0x80000000 | 16 | #define PREEMPT_NEED_RESCHED 0x80000000 |
18 | 17 | ||
19 | /* | 18 | #include <asm/preempt.h> |
20 | * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users | ||
21 | * that think a non-zero value indicates we cannot preempt. | ||
22 | */ | ||
23 | static __always_inline int preempt_count(void) | ||
24 | { | ||
25 | return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED; | ||
26 | } | ||
27 | |||
28 | static __always_inline int *preempt_count_ptr(void) | ||
29 | { | ||
30 | return ¤t_thread_info()->preempt_count; | ||
31 | } | ||
32 | |||
33 | /* | ||
34 | * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the | ||
35 | * alternative is loosing a reschedule. Better schedule too often -- also this | ||
36 | * should be a very rare operation. | ||
37 | */ | ||
38 | static __always_inline void preempt_count_set(int pc) | ||
39 | { | ||
40 | *preempt_count_ptr() = pc; | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * We fold the NEED_RESCHED bit into the preempt count such that | ||
45 | * preempt_enable() can decrement and test for needing to reschedule with a | ||
46 | * single instruction. | ||
47 | * | ||
48 | * We invert the actual bit, so that when the decrement hits 0 we know we both | ||
49 | * need to resched (the bit is cleared) and can resched (no preempt count). | ||
50 | */ | ||
51 | |||
52 | static __always_inline void set_preempt_need_resched(void) | ||
53 | { | ||
54 | *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED; | ||
55 | } | ||
56 | |||
57 | static __always_inline void clear_preempt_need_resched(void) | ||
58 | { | ||
59 | *preempt_count_ptr() |= PREEMPT_NEED_RESCHED; | ||
60 | } | ||
61 | |||
62 | static __always_inline bool test_preempt_need_resched(void) | ||
63 | { | ||
64 | return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED); | ||
65 | } | ||
66 | 19 | ||
67 | #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) | 20 | #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) |
68 | extern void add_preempt_count(int val); | 21 | extern void add_preempt_count(int val); |