sched: Consolidate open coded preemptible() checks
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 19 Jun 2013 21:56:22 +0000 (23:56 +0200)
committerFrederic Weisbecker <fweisbec@gmail.com>
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 <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>
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 {