Skip to content

Commit fbb00b5

Browse files
committed
sched: Consolidate open coded preemptible() checks
preempt_schedule() and preempt_schedule_context() open code their preemptability checks. Use the standard API instead for consolidation. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Li Zhong <zhong@linux.vnet.ibm.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Alex Shi <alex.shi@intel.com> Cc: Paul Turner <pjt@google.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Vincent Guittot <vincent.guittot@linaro.org>
1 parent ae920eb commit fbb00b5

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

‎kernel/context_tracking.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,9 @@ void user_enter(void)
8787
*/
8888
void __sched notrace preempt_schedule_context(void)
8989
{
90-
struct thread_info *ti = current_thread_info();
9190
enum ctx_state prev_ctx;
9291

93-
if (likely(ti->preempt_count || irqs_disabled()))
92+
if (likely(!preemptible()))
9493
return;
9594

9695
/*

‎kernel/sched/core.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,13 +2510,11 @@ void __sched schedule_preempt_disabled(void)
25102510
*/
25112511
asmlinkage void __sched notrace preempt_schedule(void)
25122512
{
2513-
struct thread_info *ti = current_thread_info();
2514-
25152513
/*
25162514
* If there is a non-zero preempt_count or interrupts are disabled,
25172515
* we do not want to preempt the current task. Just return..
25182516
*/
2519-
if (likely(ti->preempt_count || irqs_disabled()))
2517+
if (likely(!preemptible()))
25202518
return;
25212519

25222520
do {

0 commit comments

Comments
 (0)