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

sched/core: Simplify preempt_count tests

Since we stopped setting PREEMPT_ACTIVE, there is no need to mask it
out of preempt_count() tests.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
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>

authored by

Peter Zijlstra and committed by
Ingo Molnar
da7142e2 1dc0fffc

+2 -3
+1 -2
include/linux/preempt.h
··· 126 126 * Check whether we were atomic before we did preempt_disable(): 127 127 * (used by the scheduler) 128 128 */ 129 - #define in_atomic_preempt_off() \ 130 - ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_DISABLE_OFFSET) 129 + #define in_atomic_preempt_off() (preempt_count() != PREEMPT_DISABLE_OFFSET) 131 130 132 131 #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) 133 132 extern void preempt_count_add(int val);
+1 -1
kernel/sched/core.c
··· 7486 7486 #ifdef CONFIG_DEBUG_ATOMIC_SLEEP 7487 7487 static inline int preempt_count_equals(int preempt_offset) 7488 7488 { 7489 - int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth(); 7489 + int nested = preempt_count() + rcu_preempt_depth(); 7490 7490 7491 7491 return (nested == preempt_offset); 7492 7492 }