.. | .. |
---|
8 | 8 | |
---|
9 | 9 | DECLARE_PER_CPU(int, __preempt_count); |
---|
10 | 10 | |
---|
| 11 | +/* We use the MSB mostly because its available */ |
---|
| 12 | +#define PREEMPT_NEED_RESCHED 0x80000000 |
---|
| 13 | + |
---|
11 | 14 | /* |
---|
12 | 15 | * We use the PREEMPT_NEED_RESCHED bit as an inverted NEED_RESCHED such |
---|
13 | 16 | * that a decrement hitting 0 means we can and should reschedule. |
---|
.. | .. |
---|
40 | 43 | #define init_task_preempt_count(p) do { } while (0) |
---|
41 | 44 | |
---|
42 | 45 | #define init_idle_preempt_count(p, cpu) do { \ |
---|
43 | | - per_cpu(__preempt_count, (cpu)) = PREEMPT_ENABLED; \ |
---|
| 46 | + per_cpu(__preempt_count, (cpu)) = PREEMPT_DISABLED; \ |
---|
44 | 47 | } while (0) |
---|
45 | 48 | |
---|
46 | 49 | /* |
---|
.. | .. |
---|
88 | 91 | */ |
---|
89 | 92 | static __always_inline bool __preempt_count_dec_and_test(void) |
---|
90 | 93 | { |
---|
91 | | - GEN_UNARY_RMWcc("decl", __preempt_count, __percpu_arg(0), e); |
---|
| 94 | + return GEN_UNARY_RMWcc("decl", __preempt_count, e, __percpu_arg([var])); |
---|
92 | 95 | } |
---|
93 | 96 | |
---|
94 | 97 | /* |
---|
.. | .. |
---|
99 | 102 | return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset); |
---|
100 | 103 | } |
---|
101 | 104 | |
---|
102 | | -#ifdef CONFIG_PREEMPT |
---|
103 | | - extern asmlinkage void ___preempt_schedule(void); |
---|
| 105 | +#ifdef CONFIG_PREEMPTION |
---|
| 106 | + extern asmlinkage void preempt_schedule_thunk(void); |
---|
104 | 107 | # define __preempt_schedule() \ |
---|
105 | | - asm volatile ("call ___preempt_schedule" : ASM_CALL_CONSTRAINT) |
---|
| 108 | + asm volatile ("call preempt_schedule_thunk" : ASM_CALL_CONSTRAINT) |
---|
106 | 109 | |
---|
107 | 110 | extern asmlinkage void preempt_schedule(void); |
---|
108 | | - extern asmlinkage void ___preempt_schedule_notrace(void); |
---|
| 111 | + extern asmlinkage void preempt_schedule_notrace_thunk(void); |
---|
109 | 112 | # define __preempt_schedule_notrace() \ |
---|
110 | | - asm volatile ("call ___preempt_schedule_notrace" : ASM_CALL_CONSTRAINT) |
---|
| 113 | + asm volatile ("call preempt_schedule_notrace_thunk" : ASM_CALL_CONSTRAINT) |
---|
111 | 114 | |
---|
112 | 115 | extern asmlinkage void preempt_schedule_notrace(void); |
---|
113 | 116 | #endif |
---|