Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched/headers: Move the PREEMPT_COUNT defines from <linux/sched.h> to <linux/preempt.h>

These defines are not really part of the scheduler's driver API, but are
related to the preempt count - so move them to <linux/preempt.h>.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

+21 -21
+21
include/linux/preempt.h
··· 55 55 /* We use the MSB mostly because its available */ 56 56 #define PREEMPT_NEED_RESCHED 0x80000000 57 57 58 + #define PREEMPT_DISABLED (PREEMPT_DISABLE_OFFSET + PREEMPT_ENABLED) 59 + 60 + /* 61 + * Disable preemption until the scheduler is running -- use an unconditional 62 + * value so that it also works on !PREEMPT_COUNT kernels. 63 + * 64 + * Reset by start_kernel()->sched_init()->init_idle()->init_idle_preempt_count(). 65 + */ 66 + #define INIT_PREEMPT_COUNT PREEMPT_OFFSET 67 + 68 + /* 69 + * Initial preempt_count value; reflects the preempt_count schedule invariant 70 + * which states that during context switches: 71 + * 72 + * preempt_count() == 2*PREEMPT_DISABLE_OFFSET 73 + * 74 + * Note: PREEMPT_DISABLE_OFFSET is 0 for !PREEMPT_COUNT kernels. 75 + * Note: See finish_task_switch(). 76 + */ 77 + #define FORK_PREEMPT_COUNT (2*PREEMPT_DISABLE_OFFSET + PREEMPT_ENABLED) 78 + 58 79 /* preempt_count() and related functions, depends on PREEMPT_NEED_RESCHED */ 59 80 #include <asm/preempt.h> 60 81
-21
include/linux/sched.h
··· 265 265 .sum_exec_runtime = ATOMIC64_INIT(0), \ 266 266 } 267 267 268 - #define PREEMPT_DISABLED (PREEMPT_DISABLE_OFFSET + PREEMPT_ENABLED) 269 - 270 - /* 271 - * Disable preemption until the scheduler is running -- use an unconditional 272 - * value so that it also works on !PREEMPT_COUNT kernels. 273 - * 274 - * Reset by start_kernel()->sched_init()->init_idle()->init_idle_preempt_count(). 275 - */ 276 - #define INIT_PREEMPT_COUNT PREEMPT_OFFSET 277 - 278 - /* 279 - * Initial preempt_count value; reflects the preempt_count schedule invariant 280 - * which states that during context switches: 281 - * 282 - * preempt_count() == 2*PREEMPT_DISABLE_OFFSET 283 - * 284 - * Note: PREEMPT_DISABLE_OFFSET is 0 for !PREEMPT_COUNT kernels. 285 - * Note: See finish_task_switch(). 286 - */ 287 - #define FORK_PREEMPT_COUNT (2*PREEMPT_DISABLE_OFFSET + PREEMPT_ENABLED) 288 - 289 268 /** 290 269 * struct thread_group_cputimer - thread group interval timer counts 291 270 * @cputime_atomic: atomic thread group interval timers.