sched: Consolidate open coded preemptible() checks
authorFrederic Weisbecker <[email protected]>
Wed, 19 Jun 2013 21:56:22 +0000 (23:56 +0200)
committerFrederic Weisbecker <[email protected]>
Mon, 12 Aug 2013 22:40:43 +0000 (00:40 +0200)
preempt_schedule() and preempt_schedule_context() open
code their preemptability checks.

Use the standard API instead for consolidation.

Signed-off-by: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Li Zhong <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Alex Shi <[email protected]>
Cc: Paul Turner <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Vincent Guittot <[email protected]>
kernel/context_tracking.c
kernel/sched/core.c

index 383f8231e43676b5c5d3ddcaca51298bd9f42aa3..942835c12ae5fc6de3b6695f52447cd1cf6eaf7d 100644 (file)
@@ -87,10 +87,9 @@ void user_enter(void)
  */
 void __sched notrace preempt_schedule_context(void)
 {
-       struct thread_info *ti = current_thread_info();
        enum ctx_state prev_ctx;
 
-       if (likely(ti->preempt_count || irqs_disabled()))
+       if (likely(!preemptible()))
                return;
 
        /*
index b7c32cb7bfebbd5912f06a421decb87b15c34bf9..3fb7acee7326b1eb5f536f1ce40794b3a8b439b9 100644 (file)
@@ -2510,13 +2510,11 @@ void __sched schedule_preempt_disabled(void)
  */
 asmlinkage void __sched notrace preempt_schedule(void)
 {
-       struct thread_info *ti = current_thread_info();
-
        /*
         * If there is a non-zero preempt_count or interrupts are disabled,
         * we do not want to preempt the current task. Just return..
         */
-       if (likely(ti->preempt_count || irqs_disabled()))
+       if (likely(!preemptible()))
                return;
 
        do {