hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/x86/include/asm/preempt.h
....@@ -8,6 +8,9 @@
88
99 DECLARE_PER_CPU(int, __preempt_count);
1010
11
+/* We use the MSB mostly because its available */
12
+#define PREEMPT_NEED_RESCHED 0x80000000
13
+
1114 /*
1215 * We use the PREEMPT_NEED_RESCHED bit as an inverted NEED_RESCHED such
1316 * that a decrement hitting 0 means we can and should reschedule.
....@@ -40,7 +43,7 @@
4043 #define init_task_preempt_count(p) do { } while (0)
4144
4245 #define init_idle_preempt_count(p, cpu) do { \
43
- per_cpu(__preempt_count, (cpu)) = PREEMPT_ENABLED; \
46
+ per_cpu(__preempt_count, (cpu)) = PREEMPT_DISABLED; \
4447 } while (0)
4548
4649 /*
....@@ -88,7 +91,7 @@
8891 */
8992 static __always_inline bool __preempt_count_dec_and_test(void)
9093 {
91
- GEN_UNARY_RMWcc("decl", __preempt_count, __percpu_arg(0), e);
94
+ return GEN_UNARY_RMWcc("decl", __preempt_count, e, __percpu_arg([var]));
9295 }
9396
9497 /*
....@@ -99,15 +102,15 @@
99102 return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
100103 }
101104
102
-#ifdef CONFIG_PREEMPT
103
- extern asmlinkage void ___preempt_schedule(void);
105
+#ifdef CONFIG_PREEMPTION
106
+ extern asmlinkage void preempt_schedule_thunk(void);
104107 # define __preempt_schedule() \
105
- asm volatile ("call ___preempt_schedule" : ASM_CALL_CONSTRAINT)
108
+ asm volatile ("call preempt_schedule_thunk" : ASM_CALL_CONSTRAINT)
106109
107110 extern asmlinkage void preempt_schedule(void);
108
- extern asmlinkage void ___preempt_schedule_notrace(void);
111
+ extern asmlinkage void preempt_schedule_notrace_thunk(void);
109112 # 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)
111114
112115 extern asmlinkage void preempt_schedule_notrace(void);
113116 #endif