sched/core: Simplify INIT_PREEMPT_COUNT
As per the following commit:
d86ee4809d
("sched: optimize cond_resched()")
we need PREEMPT_ACTIVE to avoid cond_resched() from working before
the scheduler is set up.
However, keeping preemption disabled should do the same thing
already, making the PREEMPT_ACTIVE part entirely redundant.
The only complication is !PREEMPT_COUNT kernels, where
PREEMPT_DISABLED ends up being 0. Instead we use an unconditional
PREEMPT_OFFSET to set preempt_count() even on !PREEMPT_COUNT
kernels.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
fe19159225
commit
87dcbc0610
1 changed files with 5 additions and 6 deletions
|
@ -606,13 +606,12 @@ struct task_cputime_atomic {
|
|||
#endif
|
||||
|
||||
/*
|
||||
* Disable preemption until the scheduler is running.
|
||||
* Reset by start_kernel()->sched_init()->init_idle().
|
||||
* Disable preemption until the scheduler is running -- use an unconditional
|
||||
* value so that it also works on !PREEMPT_COUNT kernels.
|
||||
*
|
||||
* We include PREEMPT_ACTIVE to avoid cond_resched() from working
|
||||
* before the scheduler is active -- see should_resched().
|
||||
* Reset by start_kernel()->sched_init()->init_idle()->init_idle_preempt_count().
|
||||
*/
|
||||
#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
|
||||
#define INIT_PREEMPT_COUNT PREEMPT_OFFSET
|
||||
|
||||
/**
|
||||
* struct thread_group_cputimer - thread group interval timer counts
|
||||
|
|
Loading…
Reference in a new issue